When and how to run prisma migrate deploy? I can't...
# orm-help
d
When and how to run prisma migrate deploy? I can't run it from my CI/CD since it doesn't have access to the production Postgres (not part of the VPC and shouldn't be), so when should it be done? And how...?
r
@Dan Shapir 👋 This has to be done during deployment itself, so the best way to do it would be in CI/CD. Since you cannot access it via CI/CD, then you need to do it before you start your application in production. So when you’re validating your application and before running
npm start
or something like that, you would need to run
prisma migrate deploy
.
d
@Ryan can this be part of the docker image? Before npm start running Prisma migrate? What will be the cost (time-wise)? And how do you suppose it's feasible in a CI/CD flow? Most (practically all) CD flows are managed not from within the cluster, but through external tooling, Github actions, circle ci, and so on, or even worse if it's GitOps with argo where you can't run random commands, none of those can run a script against the DB...
r
an this be part of the docker image? Before npm start running Prisma migrate? What will be the cost (time-wise)?
Yes that’s the way to go as you cannot access the database while deployment. It will be fast as it just needs to apply those migrations to the database.
👍 1