因此,在第一次部署到Heroku遇到问题之后,我想让开发环境运行Postgres。
那时,我无法让开发环境正常工作。我的错误在数据库里。我正在运行Rails 3.2,Postgres.app,我有一个数据库设置,我认为database.yml是个不错的选择。
据我所知,我的schema.rb是空白的。本来就不是。当我删除它并重置数据库时,新的schema.rb仍然是空的。模式从哪里获得它的信息?
Rake db:migrate返回此SELECT "schema_migrations"."version" FROM "schema_migrations"
rails s错误抱怨缺少一个users表。是啊。
诚然,我在第一次开始的时候就编辑了schema.rb。但我不知道是什么导致了这种重置。
database.yml
development:
adapter: postgresql
database: phriends
encoding: utf8
username: mrbubbles
password:
test:
adapter: postgresql
database: test
encoding: utf8
username: mrbubbles
password:
production:
adapter: postgresql
database: production_database
encoding: utf8
username: mrbubbles
password:发布于 2013-11-07 18:44:43
听起来你没有rake db:setup,db:setup会
创建数据库,加载模式,并使用种子数据进行初始化(使用
db:reset先删除db )
请注意“加载模式”部分,它将读取schema.rb并根据它所述内容构建表。因此,恢复您的schema.rb并执行db:setup。
https://stackoverflow.com/questions/19842935
复制相似问题