开发者

How can I empty all the results in the database?

开发者 https://www.devze.com 2023-02-20 06:32 出处:网络
I have the db:seed task which can add me initial data 开发者_如何学Goin the database. Is there anyway of clearing the database, so that it will remove all the contents of all the databases, but leave

I have the db:seed task which can add me initial data 开发者_如何学Goin the database. Is there anyway of clearing the database, so that it will remove all the contents of all the databases, but leave the tables there, so that I don't have to run all the migrations again?


If you re-setup a clean database, you shouldn't run the migrations, you should load the schema.rb via db:schema:load (bigger projects will have code in migrations that won't run anymore, for example because classes were renamed).

rake db:drop db:create db:schema:load db:seed


You can also run rake db:migrate:reset; rake db:seed

0

精彩评论

暂无评论...
验证码 换一张
取 消