Could I just delete all my existing migrations aft...
# orm-help
s
Could I just delete all my existing migrations after going through the development phase? it seems a bit stupid to apply sequentially all the stupid ways I've modified the data throughout development to the end production DB, is there any downside, possible pitfall with doing this?
βœ… 1
t
If before applying migrate deploy to production DB, you can do and just only remove not necessary, un-applied migration files in migrations folder, and run
prisma migrate dev
in development db to create new migration files. If after applying, you must fix db tables manually and marking the migration file applied or rolled back. Be careful, because it’s tough to fix. You should demonstrate cloned db of your production before applying it to production. See the thread if you want details. https://prisma.slack.com/archives/CA491RJH0/p1656410303839809
n
Hey @Sebastian Gug πŸ‘‹ Can you have a look at Squashing migrations guide? This is essentially what you are looking for
Squashing migrations can be useful when developing with a branch-based workflow. During a large local development effort on a feature branch you might generate multiple migrations using
migrate dev
. After the feature is finished, the migration history might contain unnecessary intermediate steps that are unwanted in the final migration history that will be pushed to the
main
branch.
Let me know if this works for you.
s
@Nurul yep that is what I'm looking for! thanks! @Takeo Kusama I see what you mean but in this case, the production database is brand new with no data in it, no tables, nothing at all.
πŸ™ 1
ah I should've been using db push anyways instead of migrations