Skip to content

feat(db): add migration rollback support for all migrations - #1812

Merged
github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
favvy0217:fix/issue-1796-migration-rollback-support
Oct 17, 2026
Merged

github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
favvy0217:fix/issue-1796-migration-rollback-support

Conversation

@favvy0217

Copy link
Copy Markdown
Contributor

Summary

Resolves #1796

Adds -- @down rollback sections to every SQL migration in db/migrations/ and backend/migrations/ so that node scripts/db-migrate-run.js down can revert any applied migration.

Changes

  • Add inline -- @down sections to all 10 db/migrations/*.sql files
  • Add inline -- @down sections to both backend/migrations/*.sql files
  • Create scripts/__tests__/migration-rollback-parity.test.js to verify every migration has a non-trivial rollback path
  • Create db/MIGRATION_ROLLBACK.md documenting the rollback workflow, commands, and safety guarantees

Acceptance Criteria

  • Rollback tested — dry-run confirms all 12 migrations have down paths
  • Documented — db/MIGRATION_ROLLBACK.md covers commands and safety
  • Safe — each down section reverses its up counterpart; ledger consistency is maintained by the transactional runner

Verification

node scripts/db-migrate-dryrun.js --migrations-dir db/migrations
# All migrations show: Rollback path: ✓ Present

node scripts/db-migrate-dryrun.js --migrations-dir backend/migrations
# All migrations show: Rollback path: ✓ Present

…s17#1796)

Add -- @down rollback sections to every SQL migration in db/migrations/
and backend/migrations/ so that  can
revert any applied migration.

Changes:
- Add inline -- @down sections to all 10 db/migrations/*.sql files
- Add inline -- @down sections to both backend/migrations/*.sql files
- Create scripts/__tests__/migration-rollback-parity.test.js to verify
  every migration has a non-trivial rollback path
- Create db/MIGRATION_ROLLBACK.md documenting the rollback workflow

Acceptance criteria:
- [x] Rollback tested — dry-run confirms all 12 migrations have down paths
- [x] Documented — db/MIGRATION_ROLLBACK.md covers commands and safety
- [x] Safe — each down section reverses its up counterpart; ledger
      consistency is maintained by the transactional runner
@drips-wave

drips-wave Bot commented Oct 17, 2026

Copy link
Copy Markdown

@favvy0217 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@github-actions
github-actions Bot merged commit 0fe57d7 into Smartdevs17:main Oct 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add migration rollback support

2 participants