fix: assign commit error to err so deferred rollback triggers (closes #125)
All checks were successful
Check / check (pull_request) Successful in 11m36s

When Commit() failed, the error was stored in commitErr instead of err,
so the deferred rollback (which checks err) was skipped.
This commit is contained in:
clawbot 2026-02-21 00:55:53 -08:00 committed by user
parent 90a4264691
commit 9eb0e0fcbf

View File

@ -113,9 +113,9 @@ func (d *Database) applyMigration(ctx context.Context, filename string) error {
return fmt.Errorf("failed to record migration: %w", err) return fmt.Errorf("failed to record migration: %w", err)
} }
commitErr := transaction.Commit() err = transaction.Commit()
if commitErr != nil { if err != nil {
return fmt.Errorf("failed to commit migration: %w", commitErr) return fmt.Errorf("failed to commit migration: %w", err)
} }
return nil return nil