What’s the recommended guidance for migrating a pr...
# orm-help
k
What’s the recommended guidance for migrating a production database without downtime?
j
Migrating from one provider to another provider? Or migrating its structure from one schema to another (rename a table for example)?
k
@Joël I'm interested in this as well
In our case we're planning to remain on the same provider(aws)
We did the database fixes, from prisma 1 to prisma 2. and currently in the process of migrating the application layer
@Joël
j
@khareta I’m curious about your exact usecase with more info, would you be ok creating a new discussion here maybe? https://github.com/prisma/prisma/discussions/
👍 1
k
@Joël Yeah sure
🙏 1
j
Conversation will continue there https://github.com/prisma/prisma/discussions/5955
k
@Joël Sorry I didn’t get back to you yesterday, my use case is deploying schema migrations.
j
So if the change is an addition it’s nice and easy, “just deploy” If you have changes that break things I can recommend looking into the expand and contract pattern https://www.tim-wellhausen.de/papers/ExpandAndContract/ExpandAndContract.html
We’re planning to add some docs on some common scenarios https://github.com/prisma/docs/issues/1351
Is that relevant to what you want to achieve @Kyle Hayes?
j
If you could, please also include docs specific to load balanced environments (eg, where different servers may have differing versions of the code)
Though that may be substantially similar to zero-downtime deployments
👍 1
k
Yes it is @Joël, thank you! Yes, @Jonathan Romano we have a load balanced environment as well. And to his point, if its an addition, then there won’t be an issue. I was also reading this article which had a similar perspective: https://betterprogramming.pub/evolving-a-database-schema-10b7f4094d14
💚 1
I liked his pattern of deploying through CI on an empty table and testing against the previous version of the code to help ensure there are no breaking changes.
👍 1
j
ooo
j
thanks for sharing!
k
@Kyle Hayes now that you mention deploying to an empty table, I found this open source tool made by Github. Supposedly it's better than Facebook's and Percona tools: https://github.com/github/gh-ost I'm not sure if this would help us. What do you think @Joël ?
👀 1
k
Well now I’m sad that this is MySQL and not Postgres like we’re using haha
j
That is super neat! Will need to explore
k
Although it has limitations, like it does not support foreign keys and triggers for example, but these weren't supported since the release in 2016. So either not updated docs or they're really unsupported: https://github.com/github/gh-ost/blob/master/doc/requirements-and-limitations.md