Skip to content

Commit

Permalink
Refactor upgrade schema to remove column default.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Jul 9, 2022
1 parent 5a5caca commit 4de5d53
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/migrations/v2.2.0.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 4de5d53

Please sign in to comment.