Wednesday, May 16, 2012

Difference between rake db:migrate db:reset and db:schema:load

db:migrate runs (single) migrations that have not run yet.

db:create creates the database

db:drop deletes the database

db:schema:load creates tables and columns within the (existing) database following schema.rb

db:setup does db:create, db:schema:load, db:seed

db:reset does db:drop, db:setup  

Normally, db:migrate used after having made changes to the schema via new migration files after creating db i.e when db already exists.

db:schema:load is used when you setup a new instance of your app.

No comments:

Post a Comment