SlintORM
Docsnpm

CLI

The slintorm CLI manages schema generation, migrations, and rollbacks. All commands read config from slintorm.config.js or the "slintorm" key in package.json, with CLI flags taking highest priority.

Command reference

CommandDescription
npx slintorm generateScan TypeScript source, write schema/generated.ts and schema/generated.json
npx slintorm migrateApply all pending migrations to the database
npx slintorm rollbackRoll back the most recent migration batch
npx slintorm rollback <name>Roll back a specific migration by model/table name
npx slintorm rollback --to <batch>Roll back to a specific batch number (all later batches removed)
npx slintorm statusShow all migrations with their applied/pending status and batch number
npx slintorm freshDrop all tables and rerun every migration. Development only.
npx slintorm drop-trackingRemove the _slint_migrations tracking table only
npx slintorm --helpPrint command reference

generate

# Generate schema files from TypeScript source
# Scans --dir (or config dir) for interfaces, outputs:
#   src/schema/generated.ts
#   src/schema/generated.json

npx slintorm generate

migrate

# Apply pending migrations
npx slintorm migrate

rollback

# Roll back the most recent batch
npx slintorm rollback

# Roll back a specific migration by name
npx slintorm rollback users

# Roll back to a specific batch number (rolls back all batches after N)
npx slintorm rollback --to 3

status

# Show pending and applied migrations with their batch numbers
npx slintorm status

# Output example:
# [✓] users       batch 1   2024-01-10
# [✓] posts       batch 1   2024-01-10
# [✗] comments    pending

fresh

Drops all tables and re-runs every migration. Destroys all data. Development only.
# Drop all tables and re-run all migrations from scratch
# USE WITH CAUTION — destroys all data in development

npx slintorm fresh

drop-tracking

# Remove the _slint_migrations tracking table
# Useful when you want to reset migration history without dropping tables
# (e.g. switching from another ORM or fixing a corrupted state)

npx slintorm drop-tracking

--help

# Print all available commands
npx slintorm --help

Config resolution and flags

# Config resolution order (highest to lowest priority):
# 1. CLI flags    --dir ./src --driver sqlite
# 2. slintorm.config.js in cwd
# 3. "slintorm" key in package.json

# Example: override dir at runtime
npx slintorm migrate --dir ./app/models --driver postgres --databaseUrl $DATABASE_URL
Terminal output

The CLI uses timestamped logging and progress bars for long-running operations. Color-coded output: green for success, yellow for pending/skipped, red for errors. All timestamps are ISO 8601 UTC.

PreviousMigrationsNextEdge / Serverless