Skip to main content

Migrations

CommandScriptWhen
Authoryarn prisma:migrateprisma migrate dev --schema=prisma/schema
Applyyarn migrate:deployprisma migrate deploy
Aliasyarn prisma:migrate-prodsame deploy
Clientyarn prisma:generatealso postinstall and pretest
Inspectyarn 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_URL is only for authoring. The example env says the shadow database must have the same extensions as production (pgvector).
  • DIRECT_DATABASE_URL bypasses 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.

Adding a migration.