diff options
| author | 2023-05-12 14:33:40 +0200 | |
|---|---|---|
| committer | 2023-05-12 14:33:40 +0200 | |
| commit | ec325fee141c1e9757144a0a4094061b56839b78 (patch) | |
| tree | 2948ab4ef5702cc8478ab2be841340b946bdb867 /vendor/github.com/uptrace/bun/migrate/migration.go | |
| parent | [frogend/bugfix] fix dynamicSpoiler elements (#1771) (diff) | |
| download | gotosocial-ec325fee141c1e9757144a0a4094061b56839b78.tar.xz | |
[chore] Update a bunch of database dependencies (#1772)
* [chore] Update a bunch of database dependencies
* fix lil thing
Diffstat (limited to 'vendor/github.com/uptrace/bun/migrate/migration.go')
| -rw-r--r-- | vendor/github.com/uptrace/bun/migrate/migration.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/vendor/github.com/uptrace/bun/migrate/migration.go b/vendor/github.com/uptrace/bun/migrate/migration.go index 6f395b7b4..1a4a67511 100644 --- a/vendor/github.com/uptrace/bun/migrate/migration.go +++ b/vendor/github.com/uptrace/bun/migrate/migration.go @@ -97,10 +97,15 @@ func Exec(ctx context.Context, db *bun.DB, f io.Reader, isTx bool) error { } var retErr error + var execErr error defer func() { if tx, ok := idb.(bun.Tx); ok { - retErr = tx.Commit() + if execErr != nil { + retErr = tx.Rollback() + } else { + retErr = tx.Commit() + } return } @@ -113,8 +118,9 @@ func Exec(ctx context.Context, db *bun.DB, f io.Reader, isTx bool) error { }() for _, q := range queries { - if _, err := idb.ExecContext(ctx, q); err != nil { - return err + _, execErr = idb.ExecContext(ctx, q) + if execErr != nil { + return execErr } } |
