bin/migration/down.ts script. Each module’s rollback script is run 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:Migration<version>.ts filename returned by getVersion()):
Options
| Option | Description | Default |
|---|---|---|
--version | Version of the migration to roll back. When omitted, the most recently applied migration is rolled back. | latest |
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 matchingdatabase: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.
- Claude
- Codex