10

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.

3 Answers 3

15
  • 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

Sign up to request clarification or add additional context in comments.

Comments

2

One creates the DB for the current environment.

One creates the DB for all environments.

Comments

2

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)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.