Deploying migrations
Hi guys,
Hoping someone can sanity check me on this. Currently in the process of trying to figure out how to run migrations in production - my prod DB is a fork of my local DB, so it will have records from previous migrations that I ran in development.
I no longer have access to those original migration files (they weren't committed to git). What's the best way to proceed here? I ran migrate dev in my local environment and it generated a single migration file, but I'm obviously a bit hesitant to just run migrate deploy in my pipeline considering my setup.
Any pointers would be massively appreciated!
Thank you
1 Reply
Update - found this:
https://www.prisma.io/docs/orm/prisma-migrate/workflows/baselining
And this:
https://www.prisma.io/docs/orm/prisma-migrate/workflows/squashing-migrations#how-to-create-a-clean-history-in-a-production-environment
And it looks like baselining is the way to go in my case#
Baselining a database | Prisma Documentation
How to initialize a migration history for an existing database that contains important data.
Squashing migrations | Prisma Documentation
How to squash multiple migration files into a single migration