rake db:migrate
-- runs the migrations and then dumbs the structure of the database to db/schema.rb
.
rake db:test:prepare
-- load the updated (from above rake db:migrate
) schema into the test database.
Because rake db:migrate
dumps the db structure into schema.rb, you can quickly restore the db using the rake db:schema:load
task instead of running all the migrations all over again on a large project. See p143 of Rails 4 In Action.
rake db:test:prepare
is similar to rake db:schema:load
. It loads the schema into the test database making the fields available on the dev db also available on the test db.
rake db:test:clone
is a combination of rake db:schema:dump
and rake db:test:load
. See this SO post.