Ruby on Rails database migration

 You can design your database diagram very well upfront but in the end there will alwaysUsers_table_before be some change in it, specially if you are going to use a technique as Ruby on Rails(RoR) for the first time. A basic example,  my “users” table looked like the image right.

After I read more and more about login and sessions I changed a lot in my database diagram. Now it is looking like this:

Users_table_after

If you work alone at a project there is no problem if you change, add or delete a field name. If you work in a group with 3 other members it starts to get annoying that they have to import a new database every time there is a change made, and they are losing there local test data that is already in the database. Well Ruby on Rails has a nice solution for this problem: Database migration. If you put every database change in a migration file and send it over to the other project members with SVN they can update there database easy and without losing there local test data.

I can go in detail of course however it is already very well described by other people. Here are some links that helped me:
garrettsnider.backpackit.com
www.emxsoftware.com/RubyOnRails/Ruby+on+Rails+Migrations+Explained
damonclinkscales.com (.pdf)


Posted

in

, , ,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *