ActiveRecord::Migration

December 12, 2007


I started a new Ruby on Rails project today, and I decided to create the database using migrations. I should have been doing this all along, but I never really understood migrations or what the benefit might be. Well, now I know. In about 10 minutes, I created my Rails migration files, and then I ran “rake db:migrate”. Bam! There was my MySQL database, just as I had planned for it to look. Amazing! To see the simplicity first hand, here is a code sample using Rails 2.0.

`

The resulting table is:

``