
266
241
|
The difference between
rake db:migrate and rake db:reset is pretty clear in my head. The thing which I don't understand is how rake db:schema:load different from the former two.
Just to be sure that I am on the same page:
Please help to clarify, if my understanding has gone wrong.
| |||
654
|
Typically, you would use db:migrate after having made changes to the schema via new migration files (this makes sense only if there is already data in the database). db:schema:load is used when you setup a new instance of your app.
I hope that helps.
UPDATE for rails 3.2.12:
I just checked the source and the dependencies are like this now:
For further information please have a look athttps://github.com/rails/rails/blob/v3.2.12/activerecord/lib/active_record/railties/databases.rake (for Rails 3.2.x) andhttps://github.com/rails/rails/blob/v4.0.5/activerecord/lib/active_record/railties/databases.rake (for Rails 4.0.x)
| ||||||||||||||||||||
|

1
|
As far as I understand, it is going to drop your database and re-create it based on your
db/schema.rb file. That is why you need to make sure that your schema.rb file is always up to date and under version control. | ||
0
|
You may find all the db do stuff in this file on github these days.
If you really want to have some SQL fun try doing a structure dump.
| ||
-1
|
Thanks for valuable post. As I found from this discussion there is only one way to recreate DB from migrations sequence i.e. NOT form
db/schema.rb . This way is the following:
| ||||||||
|
rake --tasks
help ? – zx1986 Nov 28 '14 at 2:42