Hi guys. Now our project is going through a big re...
# orm-help
m
Hi guys. Now our project is going through a big refactoring stage, at the end of which we want to get the project much cleaner. We have significantly improved our database schema. And now it will rarely change. At the same time, I am concerned that there are a huge number of historical migrations in the directory with migrations. I would really like to squash them into one. Realizing that there is no standard mechanism for this, I developed my own strategy for how this can be done on the production DB. Someone confirm that I think it is correct and that no data should be lost First, locally (on the dev) I delete all migrations, start the process of rolling migrations, at the output of which I get 1 migration in my migrations folder. It now contains a script for creating the entire current database schema Then I go to the database on production, there I delete all rows from the table with migrations and add 1 single row with the name of the locally generated migration and mark it as completed. Thus, when redeploying on prod, the prisma will not do anything, since it will see that the migration with the same name has already been applied to the database. It is worth saying that at the moment we have 1 DB instance for production, so it should be pretty painless