gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 0e12ee0aa10a1f5ffed4d62e3d9f858c8faa8116
parent 13e4bbdbfa104a2384834b634285dce2f4dafe2e
Author: Mara Sophie Grosch <littlefox@lf-net.org>
Date:   Thu, 16 Jun 2022 11:22:51 +0200

postgres locale: fix accounts.note_raw migration (#651)

Database migration 20220506110822_add_account_raw_note.go has some error
handling code to detect some error messages as "ok", but only done for
english error messages. This commit adds a check for the specific error
code, which should be locale agnostic.
Diffstat:
Minternal/db/bundb/migrations/20220506110822_add_account_raw_note.go | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/internal/db/bundb/migrations/20220506110822_add_account_raw_note.go b/internal/db/bundb/migrations/20220506110822_add_account_raw_note.go @@ -28,7 +28,7 @@ import ( func init() { up := func(ctx context.Context, db *bun.DB) error { _, err := db.ExecContext(ctx, "ALTER TABLE ? ADD COLUMN ? TEXT", bun.Ident("accounts"), bun.Ident("note_raw")) - if err != nil && !(strings.Contains(err.Error(), "already exists") || strings.Contains(err.Error(), "duplicate column name")) { + if err != nil && !(strings.Contains(err.Error(), "already exists") || strings.Contains(err.Error(), "duplicate column name") || strings.Contains(err.Error(), "SQLSTATE 42701")) { return err } return nil