Skip to content

feat: implement migration rollback scripts#310

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
Dennis-Ritchie1:feat/issue-299-migration-rollback-scripts
Apr 23, 2026
Merged

feat: implement migration rollback scripts#310
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
Dennis-Ritchie1:feat/issue-299-migration-rollback-scripts

Conversation

@Dennis-Ritchie1
Copy link
Copy Markdown
Contributor

Summary

Implements full migration rollback capability for Issue #299.

Changes

  • 6 migration files (–) covering users, course, course_module, lesson, enrollment, and the migrations tracking table
  • Every migration has a down() that is the exact inverse of its up() — drops tables, indexes, and enum types in reverse order
  • migration.registry.ts — central registry wiring all migrations in dependency order
  • Fixed getRegisteredMigrations() in MigrationService and RollbackService (previously returned [], making rollback non-functional)
  • Added rollbackByName() and rollbackToVersion() to RollbackService
  • Fixed the NOT_IMPLEMENTED specific-rollback endpoint in MigrationController
  • Added POST /migrations/rollback/to/:migrationName endpoint
  • Added migrate:run, migrate:status, migrate:rollback, migrate:rollback:count, migrate:rollback:to, migrate:reset npm scripts
  • Added docs/migrations.md with full usage, rollback, and environment guidance

Testing

  • All modified files pass TypeScript diagnostics with zero errors
  • Rollback flow: run migrate:run → verify schema → run migrate:rollback → verify schema restored

Close #299

- Add 6 migration files (001-006) covering users, courses, modules,
  lessons, enrollments, and the migrations tracking table
- Each migration has a fully reversible down() method that is the
  exact inverse of its up() (drops tables, indexes, enum types)
- Add MigrationRegistry to wire all migrations in dependency order
- Fix getRegisteredMigrations() in MigrationService and RollbackService
  (previously returned empty array, making rollback non-functional)
- Add rollbackByName() and rollbackToVersion() to RollbackService
- Fix NOT_IMPLEMENTED specific-rollback endpoint in MigrationController
- Add POST /migrations/rollback/to/:migrationName endpoint
- Add migrate:run, migrate:status, migrate:rollback, migrate:rollback:count,
  migrate:rollback:to, migrate:reset npm scripts to package.json
- Add docs/migrations.md with full usage, rollback, and env guidance
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 23, 2026

@Dennis-Ritchie1 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

@RUKAYAT-CODER
Copy link
Copy Markdown
Contributor

Kindly fix CI

@RUKAYAT-CODER RUKAYAT-CODER merged commit 35964ad into rinafcode:main Apr 23, 2026
6 of 8 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.

Migration Scripts

2 participants