Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Production database not created by rake db:create command

Im a Rails beginner and am using Rails 3 on Ubuntu 10.10. My database.yml is as follows.

development:
  adapter: mysql
  database: project_dev
  username: root
  password: rootpassword
  host: localhost

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: mysql
  database: project_test
  username: root
  password: rootpassword
  host: localhost

production:
  adapter: mysql
  database: project_production
  username: root
  password: rootpassword
  host: localhost

Then i switched to the project folder and ran the command:

rake db:create

But,only the project_dev and project_test databases were created. The project_production database did not exist in mysql. What could the problem here ?

Please Help Thank You

like image 459
Joe Avatar asked Dec 09 '10 18:12

Joe


2 Answers

That is the way it is intended to be. To create the production database do:

RAILS_ENV=production rake db:create

Also, have a look at rake db:setup which will run anything you put in db/seeds.rb.

like image 135
iain Avatar answered Oct 22 '22 13:10

iain


This is by design as @iain suggests. To create all databases, run rake db:create:all.

like image 9
noodl Avatar answered Oct 22 '22 11:10

noodl