diff --git a/cmd/upgrade.go b/cmd/upgrade.go index 48f525f..44eb4be 100644 --- a/cmd/upgrade.go +++ b/cmd/upgrade.go @@ -27,6 +27,7 @@ type migFunc struct { var migList = []migFunc{ {"v0.4.0", migrations.V0_4_0}, {"v0.7.0", migrations.V0_7_0}, + {"v0.8.0", migrations.V0_8_0}, } // upgrade upgrades the database to the current version by running SQL migration files @@ -52,7 +53,7 @@ func upgrade(db *sqlx.DB, fs stuffbin.FileSystem, prompt bool) { // No migrations to run. if len(toRun) == 0 { - lo.Printf("no upgrades to run. Database is up-to-date.") + lo.Printf("no upgrades to run. Database is up to date.") return } diff --git a/internal/migrations/v0.8.0.go b/internal/migrations/v0.8.0.go new file mode 100644 index 0000000..5e7537b --- /dev/null +++ b/internal/migrations/v0.8.0.go @@ -0,0 +1,18 @@ +package migrations + +import ( + "github.com/jmoiron/sqlx" + "github.com/knadh/koanf" + "github.com/knadh/stuffbin" +) + +// V0_8_0 performs the DB migrations for v.0.8.0. +func V0_8_0(db *sqlx.DB, fs stuffbin.FileSystem, ko *koanf.Koanf) error { + _, err := db.Exec(` + INSERT INTO settings (key, value) VALUES ('privacy.individual_tracking', 'false') + ON CONFLICT DO NOTHING; + INSERT INTO settings (key, value) VALUES ('messengers', '[]') + ON CONFLICT DO NOTHING; + `) + return err +}