From 3169db99bd1f03c9be25d2daf1d7391614b78974 Mon Sep 17 00:00:00 2001 From: Terin Stock Date: Mon, 31 Oct 2022 21:45:30 +0100 Subject: [bugfix] create admin_account_actions table in tx The migration that adds the `admin_account_actions` table also added indexes. While the indexes were created within the transaction, the table was created outside the transaction. These could race, causing the migration to file. This changeset corrects the creation of the new table to also happen within the transaction. --- internal/db/bundb/migrations/20220315160814_admin_account_actions.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/db/bundb/migrations/20220315160814_admin_account_actions.go b/internal/db/bundb/migrations/20220315160814_admin_account_actions.go index 8691a98c0..479074f3e 100644 --- a/internal/db/bundb/migrations/20220315160814_admin_account_actions.go +++ b/internal/db/bundb/migrations/20220315160814_admin_account_actions.go @@ -29,7 +29,7 @@ func init() { up := func(ctx context.Context, db *bun.DB) error { return db.RunInTx(ctx, nil, func(ctx context.Context, tx bun.Tx) error { // create table for the new admin action struct - if _, err := db.NewCreateTable().Model(>smodel.AdminAccountAction{}).IfNotExists().Exec(ctx); err != nil { + if _, err := tx.NewCreateTable().Model(>smodel.AdminAccountAction{}).IfNotExists().Exec(ctx); err != nil { return err } -- cgit v1.3