fix: assign commit error to err so deferred rollback triggers (closes #125)

When Commit() failed, the error was stored in commitErr instead of err,
so the deferred rollback (which checks err) was skipped.
Цей коміт міститься в:
2026-02-26 02:00:34 -08:00
зафіксовано user
джерело 28c97bf49d
коміт 3ff2b1847f
+3 -3
Переглянути файл
@@ -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