Hi. Thank you for the new [prisma migration](<http...
# prisma-migrate
h
Hi. Thank you for the new [prisma migration](https://www.prisma.io/blog/prisma-migrate-preview-b5eno5g08d0b). I have a question on applying this to github workflow. We need to run
prisma migrate dev
and
prisma migrate deploy
to update our remote database and this should be done before merging the
PR
since the queries won’t work without it. The sourcecode will be deployed to production when merged to master. The problem is, when we run
prisma migrate dev
the prompt appears (Type in migration name) and we need to type in something to apply it. Should we run it before pushing the commits to
branch
that would be merged to
master
? Currently, in our opensource project (https://github.com/dooboolab/hackatalk), we are doing
prisma migrate dev
and
prisma migrate deploy
locally when we updates
schema.ts
but I am wondering if this could be done over the air.
j
So the workflow of creating and applying a migration is: • Do changes to your schema • Use
prisma migrate dev
locally, it will detect changes, create a migration and apply it • Commit the migration files to Git • In CI / production run
prisma migrate deploy
it will check if there are migrations to apply and apply them
❤️ 1
Does this help?
a
Yes, the workflow should be as described by @Joël above. You should not run migrate dev against the production database, ever. You use
prisma migrate dev
to iterate on the schema and create migrations and update your development database, then you commit these migrations to a branch, after merging the branch you just need to run
prisma migrate deploy
from your master/main/deploy branch against the production database.
❤️ 1
h
Very helpful! Thanks for the reply 🙏