Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server schema evolution (migrations)

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)?

like image 524
alexey Avatar asked Sep 10 '11 12:09

alexey


People also ask

What is SQL schema migration?

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.

How do you schema migration?

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.

What is data schema evolution?

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.


1 Answers

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!

like image 146
marc_s Avatar answered Sep 21 '22 20:09

marc_s