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:crea开发者_如何学运维te
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
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
.
This is by design as @iain suggests. To create all databases, run rake db:create:all
.
精彩评论