gpt4 book ai didi

ruby-on-rails - 生产数据库不是由 rake db :create command 创建的

转载 作者:行者123 更新时间:2023-12-03 11:04:24 25 4
gpt4 key购买 nike

我是 Rails 初学者,我在 Ubuntu 10.10 上使用 Rails 3。我的database.yml 如下。

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

然后我切换到项目文件夹并运行命令:
rake db:create

但是,只创建了 project_dev 和 project_test 数据库。 mysql 中不存在 project_production 数据库。这里有什么问题?

请帮忙
谢谢你

最佳答案

这就是它的本意。要创建生产数据库,请执行以下操作:

RAILS_ENV=production rake db:create

另外,看看 rake db:setup它将运行您放入的任何内容 db/seeds.rb .

关于ruby-on-rails - 生产数据库不是由 rake db :create command 创建的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4401904/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com