compozy migrate
Database migration commands with automatic driver detection for PostgreSQL and SQLite.
Run schema migrations for the active database driver. Compozy detects PostgreSQL or SQLite based on your configuration and applies the correct migration set.
Usage
compozy migrate [command]Commands
| Command | Description |
|---|---|
up | Applies all pending migrations. |
down | Rolls back the most recent migration batch. |
status | Displays applied vs. pending migrations. |
Multi-Database Support
# Apply migrations (auto-detects driver from compozy.yaml or CLI flags)
compozy migrate up
# Check migration status
compozy migrate status
# Roll back last migration batch
compozy migrate down- PostgreSQL and SQLite use separate migration files tuned for each SQL dialect.
- Switching drivers? Run
compozy migrate upafter updatingdatabase.driverto ensure the new backend schema exists. - For SQLite, keep the
.dbfile available before running migrations; the CLI creates it if missing.
Driver Overrides
# Force PostgreSQL migrations even if config defaults apply
compozy migrate up --db-driver=postgres --db-conn-string=postgres://...
# Migrate an SQLite file
compozy migrate up --db-driver=sqlite --db-path=./data/compozy.dbFlags mirror those available on compozy start, ensuring parity between runtime and migration workflows (--db-driver, --db-path, --db-conn-string).
Troubleshooting
no such table: migrations were not applied for the selected driver—reruncompozy migrate up.database is locked(SQLite): close other processes and consider enabling WAL mode before retrying.permission denied(PostgreSQL): ensure the database user can create tables, indexes, and sequences.