Me and my team have worked on a project separately from other team. That team worked for 2 years on this project and now they are leaving, leaving us the entire project and in the past 2 months we had to learn about the project and add some features (like multi-currency, new onboarding process etc) and this features implies new columns in the database, new tables and so on. And we need to update the old production database to new one, without breaking anything (we can't just delete it and start fresh with the new scripts). We want to create some generic script in Java Spring for this and other migrations in the future, something like "take this table and add this column if it doesn't exists, but if it exists and it is empty/null, add this data in it (for example, phone_number that every user needs to have and if it is not present, add something autoincrement: 000000001, 00000002 etc., and after that we need to ask users to verify their phone and override that 0000001, 0000002)". And so with that, we can have the old schema look exactly like the new one and we want to create an interface or something to make more generic those migrations. How do you think is the best to resolve this?
Thank you!