-
Notifications
You must be signed in to change notification settings - Fork 1
Opinions
Every piece of software encodes certain opinions. These are the primary opinions that are manifest in the design of dotMigrator.
Two problems:
- avoiding data loss
- different migration scripts for different targets
Instead of inventing a fluent interface or other DSL to describe the data structure, SQL is already a complete language for making the changes needed in a SQL database
Sometimes data structure changes mean that data needs to be re-processed in some way through application code which can't easily be done in SQL.
Or even if it can be done in SQL, it would mean re-writing code that already exists in the application code
Other data storage systems such as document databases, or maybe even filesystems hold data structures that may need to be declared up-front, or at least contain data whose "shape" needs to change during application upgrades.
... and should be in source control with the application code. It should be possible to compare tagged releases and see a textual representation of the data structure changes between them.
Ideally, the steps are 1) install an appropriate IDE, 2) retrieve source code, 3) build, 4) run. Therefore, dotMigrator should be easy to integrate into the project's Build and/or run steps.
Some migrations can't be done as part of a transaction simply due to database limitations. Sometimes the amount of data that needs to change is too large to effectively manage in a single transaction.
If possible, migrations that affect a large amount of data should be written so that they can run while the application remains online. The application would be updated to work simultaneously with both the pre- and post-migrated data. Then the migration runs "online" until all the data can be migrated. Then the application could be updated again to work with only the post-migrated data.
You have pre-production environments for development, testing and verification. Don't jeopardize your production release by deploying differently than you did in your testing/verification environment. Once a data store is under management with dotMigrator, do not make data structure changes outside of dotMigrator.
If you have multiple production instances, (i.e. for different customers), this is even more important.
Even if you don't have multiple environments or instances, each developer should have a separate instance and they need to keep their own up-to-date with each other.
... but it's not o.k. in a single persistent data store. Your production database evolves linearly even if development is done concurrently in separate branches. Merging data structure changes in source control should not be a hard thing to do. This is why migrations are discovered and sequenced by their name and there aren't separate manifest files that would need to be merged.