First Migration
Datrix compares your schema definitions against the current database state and generates the necessary SQL operations. No migration files to write by hand.
Run migrations
$npx datrix migrate
Datrix will load your datrix.config.ts, diff your schemas against the database, and prompt
you to confirm before applying any changes.
Datrix Migration Tool
Migration Plan:
Tables to CREATE:
+ user
Total operations: 1
Apply these migrations? (y/N): y
✔ Migrations applied successfully
Dry run
Preview what will change without applying anything:
$npx datrix migrate --dry-run
Options
| Flag | Description |
|---|---|
--dry-run | Preview changes without applying |
--verbose | Show field-level details in the plan |
--config <path> | Path to config file (default: ./datrix.config.ts) |
Ambiguous changes
When Datrix detects a change that could be interpreted as either a rename or a drop+add (e.g. you renamed a field), it will ask you to resolve it interactively before proceeding.
Ambiguous changes detected:
user.name → user.fullName
1. Rename column (preserves data)
2. Drop and add (loses data)
Choose option (1-2):
For full migration details — programmatic usage, rollbacks, and advanced options — see CLI.