Prisma not rolling back failed migration during vercel deployment
I've ran into a strange situation where during a deployment to vercel, I run the prisma generate && prisma migrate deploy as a build command. I had a migration fail during this. I went through, rolled it back, fixed it, then pushed the changes back to production. However, I noticed that prisma was not attempting to re-run the migration as it was marked as failed in the _prisma_migrations tables. I had to manually delete the migration entry for the migration to re apply correctly. My question is: Is there a correct process for re running failed migrations in production? I followed the instructions here https://www.prisma.io/docs/orm/prisma-migrate/workflows/patching-and-hotfixing#option-2-manually-complete-migration-and-resolve-as-applied. However it doesnt seem the migration was marked as rolled back.
- Does rolled back have to be run in production OR can we run it locally and merge to production?
Patching & hotfixing | Prisma Documentation
How to reconcile the migration history after applying a hotfix or patch to a production environment.
3 Replies
You chose to debug with a human. They'll tinker with your query soon. If you get curious meanwhile, hop into
#ask-ai
for a quick spin!aI sez we have to run directly against prod
although...does anyone know how to run a command against an active vercel deployment
Can you elaborate on what you meant by running command against active vercel deployment? Do you mean you want to run a migration against a different database other than production?