migrate
Apply pending migrations to your configured database.
Usage
- npm
- pnpm
- Bun
- Yarn
npx durcno migrate [--config path/to/durcno.config.ts]
pnpm dlx durcno migrate [--config path/to/durcno.config.ts]
bun x durcno migrate [--config path/to/durcno.config.ts]
yarn dlx durcno migrate [--config path/to/durcno.config.ts]
What it does
- Finds migrations in the configured
outdirectory that have not yet been applied. - Executes the DDL statements exported by each migration's
up.tsin order. - Records applied migrations in the
durcno.migrationstable.
Before you run
- Make sure the generated
up.tsfiles (which export arrays of DDL statement objects) are reviewed and safe for your target environment. - Back up your database if applying to production.
Example
- npm
- pnpm
- Bun
- Yarn
npx durcno migrate
pnpm dlx durcno migrate
bun x durcno migrate
yarn dlx durcno migrate
Troubleshooting
- If a migration fails mid-apply, check the database state and the migration SQL. You may need to roll back the partial changes manually, fix the SQL, then re-run.
- If a migration was applied outside Durcno or manually altered,
statuscan help diagnose mismatches.
Next: check migration status with npx durcno status or roll back with npx durcno down.