Skip to content
Prince Carlo Juguilon edited this page Jul 27, 2022 · 2 revisions

1. Migration

During our initial "development" period, we've been using prisma db push to quickly iterate on our schema. Now that we have users in production, some schema changes will prompt a reset of the database when we still use prisma db push. This is why from now on moving forward, all changes in schema.prisma should run prisma migrate dev and resolve any conflicts with current schema.

prisma migrate dev will create a folder under prisma/migrations/ describing the added/removed things from the current schema -> new schema.

How to sync our schema change to production database?

We should ideally have a github workflow that automatically runs prisma migrate deploy whenever a push happens in main branch. prisma migrate deploy will apply pending migrations to the production database. We should also have a workflow for dev branch which would have separate env variables for DATABASE_URL

Clone this wiki locally