Skip to main content

Adding a migration

From pnxt-api-nestjs:

yarn prisma:migrate

That runs prisma migrate dev --schema=prisma/schema. The shadow database (SHADOW_DATABASE_URL) must exist and have pgvector.

Then:

yarn prisma:generate

postinstall already generates the client. Generate again if you are not reinstalling.

Apply on a deployed database with:

yarn migrate:deploy

Do not edit a migration folder that has been applied. Add a new migration.

Commit the schema change and the generated SQL. Do not commit .env.

If the model is new, the migration is incomplete until tenancy classification lands in the same change.