A clean, Markdown-based publishing platform made for writers. Write together, and build a community. https://writefreely.org
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

59 righe
1.4 KiB

  1. /*
  2. * Copyright © 2021 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 supportLetters(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 publishjobs (
  18. id ` + db.typeIntPrimaryKey() + `,
  19. post_id ` + db.typeVarChar(16) + ` not null,
  20. action ` + db.typeVarChar(16) + ` not null,
  21. delay ` + db.typeTinyInt() + ` not null
  22. )`)
  23. if err != nil {
  24. t.Rollback()
  25. return err
  26. }
  27. _, err = t.Exec(`CREATE TABLE emailsubscribers (
  28. id ` + db.typeChar(8) + ` not null,
  29. collection_id ` + db.typeInt() + ` not null,
  30. user_id ` + db.typeInt() + ` null,
  31. email ` + db.typeVarChar(255) + ` null,
  32. subscribed ` + db.typeDateTime() + ` not null,
  33. token ` + db.typeChar(16) + ` not null,
  34. confirmed ` + db.typeBool() + ` default 0 not null,
  35. allow_export ` + db.typeBool() + ` default 0 not null,
  36. constraint eu_coll_email
  37. unique (collection_id, email),
  38. constraint eu_coll_user
  39. unique (collection_id, user_id),
  40. PRIMARY KEY (id)
  41. )`)
  42. if err != nil {
  43. t.Rollback()
  44. return err
  45. }
  46. err = t.Commit()
  47. if err != nil {
  48. t.Rollback()
  49. return err
  50. }
  51. return nil
  52. }