From 4de5d53fe455fcfb6aa877dc551d9dc0bbf8ab11 Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Sun, 3 Jul 2022 10:13:10 +0530 Subject: [PATCH] Refactor upgrade schema to remove column default. --- internal/migrations/v2.2.0.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/migrations/v2.2.0.go b/internal/migrations/v2.2.0.go index 2863c0e7..21082949 100644 --- a/internal/migrations/v2.2.0.go +++ b/internal/migrations/v2.2.0.go @@ -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 }