Refactor upgrade schema to remove column default.

This commit is contained in:
Kailash Nadh 2022-07-03 10:13:10 +05:30
parent 5a5caca256
commit 4de5d53fe4

View file

@ -23,7 +23,10 @@ func V2_2_0(db *sqlx.DB, fs stuffbin.FileSystem, ko *koanf.Koanf) error {
return err
}
if _, err := db.Exec(`ALTER TABLE templates ADD COLUMN IF NOT EXISTS "subject" TEXT NOT NULL`); err != nil {
if _, err := db.Exec(`ALTER TABLE templates ADD COLUMN IF NOT EXISTS subject TEXT NOT NULL DEFAULT ''`); err != nil {
return err
}
if _, err := db.Exec(`ALTER TABLE templates ALTER COLUMN subject DROP DEFAULT`); err != nil {
return err
}