Migrations
| Command | Script | When |
|---|---|---|
| Author | yarn prisma:migrate | prisma migrate dev --schema=prisma/schema |
| Apply | yarn migrate:deploy | prisma migrate deploy |
| Alias | yarn prisma:migrate-prod | same deploy |
| Client | yarn prisma:generate | also postinstall and pretest |
| Inspect | yarn prisma:studio |
Compose does not migrate on start. The API health check fails on an empty database until migrate:deploy has run. That is expected. The production bootstrap runbook says the same thing: docs/runbooks/production-bootstrap.md.
Rules
- Edit
prisma/schema/*.prisma, then generate a migration. Do not hand-edit applied SQL. - Commit the new migration folder only.
SHADOW_DATABASE_URLis only for authoring. The example env says the shadow database must have the same extensions as production (pgvector).DIRECT_DATABASE_URLbypasses PgBouncer. Use it for migrate deploy when the pooled URL cannot run migrations.
Tenancy
A new model is not done when the migration applies. Add it to tenancy.extension.ts or the architecture test fails.
Legacy
migrate:laravel is referenced by a LEGACY_DATABASE_URL comment. Safety on a non-empty database is unknown. The production bootstrap runbook describes a fresh deployment and says no legacy data is migrated.