Migrations
VeloxTS uses Prisma for database migrations.
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”VeloxTS 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 deployNext Steps
Section titled “Next Steps”- Seeding - Test data
- Prisma 7 Setup - Configuration