Have you ever tried out or read about or used Ruby on Rails? Well I’ve been checking it out for a couple of weeks now and it is a fascinating piece of work. There are imho only a couple of big issues with it, but I will talk about that in another post.
One of the very best things I find in RoR is the concept of Migrations.
Migrations allow you to write code that describes the schema incrementally. This means your database schema can evolve, a higly prized fact in Agile Development. What we did in the past was add or remove tables and columns as we needed them. But there was a problem. Your source code is under source control right. So when you want to roll back something, how do you roll back your database schema? Tricky, right. So the answer to that question is to have your database schema exported and kept in source control too. Then you would tear down the DB and rebuild it from the exported file. But then you lose all your data.
I know there are solutions to all those problems. But what if you could just run a command to rollback the last iteration of the DB schema? That would certainly make things a lot easier right?
So in RoR they (or maybe someone else, but I learned from them) introduced Migrations. Each migration has two methods, up and down, and each migration describes a change to a DB schema and holds a sequential number. The number describes sort of a step. So when you want to rollback to a version, you say to which sequence number and the migration thing works out what it has to do to get there.
Another thing i really like with Migrations is you can move your DB to a different technology, you can easily develop on SQLite and have production on a MySQL and later move to a MS SQL. just run the migration and the migrator takes care of using the correct dialect!
Now I wanted this in .NET, not in Rails! So along came a very friendly guy called Marc-André Cournoyer, who I stumbled upon via blogsearch. I saw this post and was sold.
So go on! go there, download it and use it allready!
I will write a seperate post on how I set it up.
July 31, 2007 at 14:47 |
thx for the link and sharing your experience Dyonisius