First, I have some questions to you:
- Do you have scripts into the Source Control Management?
- Do you know which scripts have been executed into the database?
- Do you write scripts for rollback?
- Are DBAs involve in your development process?
- Tell me, how do you manage your database changes?
If I were a new team member, I will ask you how to build my database and maybe this would be your answer “Let me get a dump from my local database and I will send you”. This is valid if your dump has the same structure that production environment but I would not be 100% sure. Another option is get a backup from production, is not a bad idea if you want to work with real data and solve a specific issue but is not ever the case. So, you must be able to build the database whenever you want.
What it is my point?
Continuous Improvement, that is my point. We need to improve our delivery process every day and Database Change Management is something that you can not forget.
Which is involve?
- Every database modification should be written as a delta script.
- Add rollback section to your scripts.
- Use a naming conventions for your scripts.
- If a delta script has already been applied to a database is subsequently modified that subsequent modification will not be applied to the database.
- Version Control your scripts.
- Maintain a database changelog.
Advantages
- Reduce risks during deployments.
- Ensure you are executing the right scripts.
- You can build a new database.
After this, you can research about some tools such as liquibase or flyway in order to automated scripts execution and then promote communication with Database Team in your job.