Talking to production SQL Server applications it's very important to support scenarios allowing to modify database schema during the application life cycle. In my particular case it's Entity Framework 4.1 application.
Today ADO.NET team works on Code First Migrations. I think it's really great but it's in alpha stage and can be used only with EF Code First.
What are the best practices to implement such a workflow writing update (up and down) scripts in SQL language for production use? Are there any supporting tools?
Deployment scenarios are also very important. How to automate migrations on a build server (using MSBuild, for example)?
Database migrations, also known as schema migrations, database schema migrations, or simply migrations, are controlled sets of changes developed to modify the structure of the objects within a relational database.
Migrations are performed programmatically by using a schema migration tool. When invoked with a specified desired schema version, the tool automates the successive application or reversal of an appropriate sequence of schema changes until it is brought to the desired state.
Schema evolution is a feature that allows users to easily change a table's current schema to accommodate data that is changing over time. Most commonly, it's used when performing an append or overwrite operation, to automatically adapt the schema to include one or more new columns.
There are quite a few - find a long list of alternatives here.
I've been looking into this myself, trying to avoid doing any further development on our own, internal home-grown solution (which is a mess....).
The one that I was intrigued about the most is Roundhouse
It works off SQL scripts (which is a must for me), it allows one-time scripts, everytime scripts and so forth, it keeps track of what it's done, it allows environment-specific scripts (e.g. stuff for your DEV
or TEST
environment that you don't want on production), it's highly configurable - looking good to me!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With