I love migrations I think they are one of the best things about rails. I love that I can count on any changes I’ve done in the database to be consistent across all other databases that I use. Love it.
Sometimes I find that I want pre-load my database with some data, like categories that I have. For testing purposes, I have already created this data in my fixture; now I just want to load that fixture into my database from a migration call.
I know that there is a rake task for this, so I looked into that code and came up with a little something.
Read the rest of this entry »
As a rails user who loves migrations, I have noticed that all of the migrations are prefixed with three decimal places, like 001_create_sessions.rb or something of that nature. That got me thinking, what would happen after I had 999 migrations?
That sets of the paranoia level up because who knows, I may need 1001 migrations! So to settle this once and for all, I wrote a script that would generate 999 migrations for me. I ran the 1000 migration and then it created 1001_test1001.rb.
Good news! Rails doesn’t constrain its migrations to a 3 decimal place prefix. So pointless…