Rails like highly featured frameworks are already packed with the rake tasks for database migrations. But recently when I was playing with cuba, a micro framework for ruby, I really wanted to setup migrations so that I can handle database changes in production without hassle. The migration tasks are not bundle with cuba, so I wrote two tasks to handle database creation and database migration. Here is my Rakefile looks like So now I can keep my ActiveRecord migration in the folder db/migrate and use the rake commands to execute it. I can create the db using the command Then migrate using the command You can use RACK_ENV to specify the environment and VERSION to specify version to which you want to migrate Eg : This can be used in both cuba and sinatra.