Skip to main content
Roll back migrations for every module that defines a bin/migration/down.ts script. Each module’s rollback script runs from its own directory. By default only the most recently applied migration is rolled back; pass --version to roll back the single migration with that version. Each rollback runs the migration’s down() inside a transaction and removes its row from the migrations table, so a later migration:up re-applies it.

Usage

Examples

Roll back the most recently applied migration:
Roll back a specific migration by its version (the timestamp in the Migration<version>.ts filename returned by getVersion()):

Options

Rolling back relies on a correct down(). If down() does not exactly reverse up(), prefer adding a new corrective migration over a rollback on shared data.

AI Skill

This command ships a matching database:migrate skill. It teaches your AI agent to drive the database lifecycle: applying and rolling back migrations, reseeding, and verifying the schema matches the entities.