Migrations
Generate a migration
After modifying the schema, generate a migration:
This creates a new SQL file in migrations/ based on the schema diff.
Run migrations
Apply pending migrations:
Rollback
Drizzle does not support automatic rollbacks. To revert a migration:
- Write a new migration that undoes the changes
- Apply it with
pnpm --filter db migrate
Migration naming
Generated migrations follow the pattern:
CI integration
Migrations run automatically in CI before deployment:
Seed data
For local development, seed the database after migrations:
The seed script creates:
- 10 test users (including 1 admin)
- 50 sample products
- 25 orders with line items