Reputation: 1290
What is the difference between rake db:create
and rake db:create:all
?
Both are equally used in order to create a database for a Rails application.
The most exhaustive information on rake for Rails I could find is at tutorialpoint but the above commands are missing.
Upvotes: 10
Views: 7119
Reputation: 1559
rake db:create:all
creates all the databases for the application (which are defined in database.yml
)rake db:create
creates the database for the current RAILS_ENV
environment. If RAILS_ENV
is not specified it defaults to the development and test databases.FYI: http://jacopretorius.net/2014/02/all-rails-db-rake-tasks-and-what-they-do.html
Upvotes: 15
Reputation: 118261
If you run rake -T | grep db
, you will see :
rake db:create
# Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV
# (use db:create:all to create all databases in the config)
Upvotes: 2
Reputation: 160170
One creates the DB for the current environment.
One creates the DB for all environments.
Upvotes: 2