Migrations
Velox TS wraps Prisma’s migration system with CLI commands for creating, running, rolling back, and checking the status of schema changes — with separate workflows for rapid development (db:push) and production deployments (migrate deploy).
Development Workflow
Section titled “Development Workflow”Push Schema (Development)
Section titled “Push Schema (Development)”pnpm db:pushSyncs schema to database without creating migration files. Fast for prototyping.
Create Migration (Production)
Section titled “Create Migration (Production)”pnpm prisma migrate dev --name add_users_tableCreates a migration file for the schema change.
CLI Commands
Section titled “CLI Commands”| Command | Description |
|---|---|
velox migrate status | Show migration status |
velox migrate run | Run pending migrations |
velox migrate rollback | Rollback last migration |
velox migrate fresh | Drop all tables and re-run |
velox migrate reset | Rollback all then re-run |
Rollback Support
Section titled “Rollback Support”Velox TS generates down.sql files for rollbacks:
velox make migration add_status_to_ordersCreates:
prisma/migrations/└── 20240115_add_status_to_orders/ ├── migration.sql # Up migration └── down.sql # Rollback migrationProduction
Section titled “Production”# Deploy migrationspnpm prisma migrate deployRelated Content
Section titled “Related Content”- Seeding - Test data
- Prisma 7 Setup - Configuration