v0.8.0.go 713 B

1234567891011121314151617181920212223
  1. package migrations
  2. import (
  3. "github.com/jmoiron/sqlx"
  4. "github.com/knadh/koanf"
  5. "github.com/knadh/stuffbin"
  6. )
  7. // V0_8_0 performs the DB migrations for v.0.8.0.
  8. func V0_8_0(db *sqlx.DB, fs stuffbin.FileSystem, ko *koanf.Koanf) error {
  9. _, err := db.Exec(`
  10. INSERT INTO settings (key, value) VALUES ('privacy.individual_tracking', 'false')
  11. ON CONFLICT DO NOTHING;
  12. INSERT INTO settings (key, value) VALUES ('messengers', '[]')
  13. ON CONFLICT DO NOTHING;
  14. -- Link clicks shouldn't exist if there's no corresponding link.
  15. -- links_clicks.link_id should have been NOT NULL originally.
  16. DELETE FROM link_clicks WHERE link_id is NULL;
  17. ALTER TABLE link_clicks ALTER COLUMN link_id SET NOT NULL;
  18. `)
  19. return err
  20. }