down
Roll back a specific migration.
Usage
- npm
- pnpm
- Bun
- Yarn
npx durcno down <migration-name> [--config path/to/durcno.config.ts]
pnpm dlx durcno down <migration-name> [--config path/to/durcno.config.ts]
bun x durcno down <migration-name> [--config path/to/durcno.config.ts]
yarn dlx durcno down <migration-name> [--config path/to/durcno.config.ts]
Arguments
<migration-name>— the folder name (or identifier) of the migration to roll back. Usenpx durcno statusto find the identifier.
What it does
- Executes the rollback statements exported by the migration's
down.tsin the specified migration folder to reverse the changes made by that migration. - Updates the migration history so the migration is no longer considered applied.
Important notes
- Only roll back migrations when you understand the consequences for data. Rolling back schema changes that drop columns or tables can permanently remove data.
- For production, prefer writing compensating migrations instead of rolling back if data loss is possible.
Example
- npm
- pnpm
- Bun
- Yarn
# Rollback a migration named 2025-10-01-add-users
npx durcno down 2025-10-01-add-users
# Rollback a migration named 2025-10-01-add-users
pnpm dlx durcno down 2025-10-01-add-users
# Rollback a migration named 2025-10-01-add-users
bun x durcno down 2025-10-01-add-users
# Rollback a migration named 2025-10-01-add-users
yarn dlx durcno down 2025-10-01-add-users
If the down.ts is missing or incomplete
- You may need to write a manual rollback DDL or a new migration that safely reverses the previous change.
Next: verify the result with npx durcno status.