Files
WRNexusJS/packages/db/test
ClintchizandClaude Opus 5 b807f7b5a7
Quality / quality (ubuntu-latest) (push) Failing after 6m4s
Quality / quality (windows-latest) (push) Canceled after 0s
fix(db): refuse to roll back a migration that defines no down section
rollback ran a migration's down section when it had one and then deleted
its tracking row either way. A migration that changed the schema without a
`-- +down` section was therefore recorded as rolled back while its change
stayed in the database, and the next migrate replayed statements such as
ALTER TABLE ADD COLUMN that cannot run twice, leaving the database stuck
between the two states with no way forward or back.

It now refuses that case with WRN-DB-MIGRATION-IRREVERSIBLE and leaves the
tracking row alone, so the database stays consistent and the operator
chooses: add a down section, or write a new migration that reverses the
change. The check runs before the lock is taken, so a dry run reports the
same refusal rather than promising a rollback that would fail.

A migration whose up is empty still rolls back by dropping its tracking
row, since there is nothing to undo. That keeps placeholder migrations
working, and `wrnexus db rollback` prints the refusal as a message rather
than a stack trace.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-03 09:57:43 +05:30
..
2026-07-12 15:55:18 +05:30