From c149766ecccc8d4ecc6b2afbe4fc59cafa4caa32 Mon Sep 17 00:00:00 2001 From: Steven Tang Date: Tue, 16 Feb 2021 19:23:18 +1100 Subject: [PATCH] fix: drop_badges_column migration for sqlite --- .../20210206_drop_badges_column_add_sharing_flags.go | 11 +++++++++-- version.txt | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/migrations/20210206_drop_badges_column_add_sharing_flags.go b/migrations/20210206_drop_badges_column_add_sharing_flags.go index 27f0fc7..0470a14 100644 --- a/migrations/20210206_drop_badges_column_add_sharing_flags.go +++ b/migrations/20210206_drop_badges_column_add_sharing_flags.go @@ -37,11 +37,18 @@ func init() { return err } + // do not drop column for sqlite, fixes #128: + // [ERROR] migration '20210206_drop_badges_column_add_sharing_flags' failed – table users already exists + // https://stackoverflow.com/a/8442173 + if cfg.Db.Dialect == config.SQLDialectSqlite { + logbuch.Info("not attempting to drop and regenerate constraints on sqlite") + return nil + } + if err := migrator.DropColumn(&models.User{}, "badges_enabled"); err != nil { return err - } else { - logbuch.Info("dropped column 'badges_enabled' after substituting it by sharing indicators") } + logbuch.Info("dropped column 'badges_enabled' after substituting it by sharing indicators") return nil }, diff --git a/version.txt b/version.txt index 0b4c970..ae96cc7 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.24.2 \ No newline at end of file +1.24.3