All,
I think the time has come for us to start considering frameworks to manage our database migrations. As the WebAPI begins to support more features, there is going to be service-specific tables that are going to be required to support the functionality, and as new releases come out and features change, having something in place to handle schema updates or data migrations (in the case of re-factoring causing tables to be split or merged) between releases will save us a lot of time.
I did a little reading on this, and it seems that two potential options is Liquibase and Flyway. This article talks about one person’s experience with Flyaway (after consdiering using Liquibase):
http://www.tikalk.com/managing-your-db-changes/
Links to these tools:
http://www.liquibase.org/
http://flywaydb.org/
Would anyone consider doing some feasibility assessment on using these tools?
One thing that I noticed in common with both of these tools is that they seem to lean towards doing a migration check during application startup. I’m not such a fan of this since I was thinking that it means that the account that normally runs the application would have to have special admin rights to execute the DDL, but looking further, I think it’s possible that we could configure WebAPI to have a special ‘migration’ database connection context (with a specific user/password that has rights required to perform migrations) that gets used during the startup-migration check, and then the normal ‘restricted’ account would be used for the normal operations of the app. I think I could live with this arrangement.
On the other hand, there does seem to be some maven plugin support with these frameworks allowing you to issue a migration action outside of running the application. So that could be an option as well.
I think I’d like to have this issue resolved before we have so many tables created to support so many service operations that it will be difficult to incorporate this feature later. Up to this point, we haven’t actually needed to add new tables to the cdm schema for anything, but this will change when we introduce spring batch, and anything else that wants to store data…
-Chris