bin/migration/up.ts script. Each module’s migration script is run from its own directory. With --drop, the database is dropped before migrations run.
Runs are cached: a module whose files are unchanged since its last successful migration:up is skipped instead of re-spawned, printing a ✔ Migrations up to date for <module> (cached) line. Because re-applying already-run migrations is a no-op, this only avoids the redundant process and database round-trip. The cache is bypassed automatically with --drop (the reset must always re-run) and can be disabled with --no-cache.
Usage
Examples
Options
Caching
Each module’s cache key hashes every source file of the module individually together with a cache version, so an entry is invalidated whenever any file the migration script could read — its migrations, its source, its bin — changes. Build and dependency folders such asnode_modules, dist, and var are excluded. Entries live under var/cache/migrations/ at the project root and only successful runs are cached; the directory is safe to delete at any time.
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