CLI Commands
Stabilize CLI v3.2.0 — 31 commands with shorthand aliases
The CLI is versioned independently of the ORM: this is the version of the stabilize-cli package, which is not the same number as the stabilize-orm release it depends on. This release bundles stabilize-orm@3.2.x and runs on Node.js 22.18+ as well as Bun — one bundle, with the SQLite driver chosen at run time. Under Node your project needs "type": "module", because the CLI imports your .ts files directly and Node would otherwise treat them as CommonJS. Every command works against MongoDB as well, with the single exception of query — a document command is not a string, so there is nothing for it to run.
Generate
generate:model <name> [fields...]g:mGenerate a model file. Pass columns as field:type.
generate:migration <name>g:mgGenerate a migration JSON from an existing model.
generate:seed <name>g:sGenerate a seed file with sample data.
generate:api <name>g:aGenerate REST API scaffold. Creates model if missing.
generate:all <name> [fields...]g:xGenerate model + migration + seed together.
generate:test <name>g:tGenerate vitest test file with CRUD stubs.
Migrate
migrateApply all pending migrations.
migrate:rollbackRoll back the most recent migration.
migrate:freshDrop all tables and re-run migrations. No seed.
migrate:statusDetailed migration status with timestamps.
migrate:pendingShow only pending migrations.
migrate:autoGORM-style auto migrate: create tables, add missing columns and indexes. Never deletes.
seedRun all pending seed files. Applied seeds are tracked in a stabilize_seed_history table, so a seed that already ran is not run twice.
Database
db:dropDrop all tables.
db:resetDrop, migrate, and seed in one command.
db:truncate [table]Truncate a specific table or all tables.
db:backupBackup database to timestamped file.
db:restore <file>Restore from backup file.
db:tablesList all tables with row counts.
db:sizeDatabase size statistics.
db:diffCompare models vs database schema.
db:consoledb:sqlInteractive SQL REPL.
db:table:info <table>Show column details for a specific table.
Model & Config
model:validateValidate all model files for errors.
model:info <name>Show columns, relations, scopes for a model.
config:initScaffold a starter config/database.ts file.
Diagnostics
statusMigration and seed status with health check.
healthDatabase and cache health check.
health:jsonJSON output for CI/CD automation.
query <sql>Execute raw SQL and display results.
infoCLI version, runtime, platform info.