summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Terin Stock <terinjokes@gmail.com>2022-10-31 21:45:30 +0100
committerLibravatar Terin Stock <terinjokes@gmail.com>2023-01-31 15:16:48 +0100
commit3169db99bd1f03c9be25d2daf1d7391614b78974 (patch)
tree2377561f6b2bbe86c9dba7287a6f3304d723bf2a
parent[chore] remove vendor (diff)
downloadgotosocial-3169db99bd1f03c9be25d2daf1d7391614b78974.tar.xz
[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.
-rw-r--r--internal/db/bundb/migrations/20220315160814_admin_account_actions.go2
1 files changed, 1 insertions, 1 deletions
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(&gtsmodel.AdminAccountAction{}).IfNotExists().Exec(ctx); err != nil {
+ if _, err := tx.NewCreateTable().Model(&gtsmodel.AdminAccountAction{}).IfNotExists().Exec(ctx); err != nil {
return err
}