mschallert
mschallert

Reputation: 4389

Setup database without seed data

I need to setup my database with tables and such, but in certain cases I don't want my seed data to be loaded. I also don't want to delete or move my db/seeds.rb file every time I want to ignore my seed data.

Is there a way to perform the tasks of rake db:setup and ignore seed data?

Upvotes: 13

Views: 3005

Answers (1)

iblue
iblue

Reputation: 30404

Yes. Just use the following two commands:

rake db:create
rake db:schema:load

What rake db:setup does is just creating the database (db:create), loading the data from db/schema.rb (db:schema:load) and then inserting the seed data (db:seed). You can do these steps separatly.

Upvotes: 17

Related Questions