A clean, Markdown-based publishing platform made for writers. Write together, and build a community. https://writefreely.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

38 lines
807 B

  1. /*
  2. * Copyright © 2023 Musing Studio LLC.
  3. *
  4. * This file is part of WriteFreely.
  5. *
  6. * WriteFreely is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License, included
  8. * in the LICENSE file in this source code package.
  9. */
  10. package migrations
  11. func supportPassReset(db *datastore) error {
  12. t, err := db.Begin()
  13. if err != nil {
  14. t.Rollback()
  15. return err
  16. }
  17. _, err = t.Exec(`CREATE TABLE password_resets (
  18. user_id ` + db.typeInt() + ` not null,
  19. token ` + db.typeChar(32) + ` not null primary key,
  20. used ` + db.typeBool() + ` default 0 not null,
  21. created ` + db.typeDateTime() + ` not null
  22. )`)
  23. if err != nil {
  24. t.Rollback()
  25. return err
  26. }
  27. err = t.Commit()
  28. if err != nil {
  29. t.Rollback()
  30. return err
  31. }
  32. return nil
  33. }