Geo
Geo

Reputation: 96997

How can I empty all the results in the database?

I have the db:seed task which can add me initial data in 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?

Upvotes: 2

Views: 70

Answers (2)

Sergey K
Sergey K

Reputation: 5107

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

Upvotes: 1

Marcel Jackwerth
Marcel Jackwerth

Reputation: 54802

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

Upvotes: 3

Related Questions