当前位置:  开发笔记 > 后端 > 正文

ActiveRecord :: NoDatabaseError FATAL:数据库"db/development.postgresql"不存在

如何解决《ActiveRecord::NoDatabaseErrorFATAL:数据库"db/development.postgresql"不存在》经验,为你挑选了1个好方法。

我正在构建一个小应用程序,它在本地工作.然后,当我在Heroku上部署它时,我的终端中出现了这个错误:

remote:        An error occurred while installing sqlite3 (1.3.11), and 

Bundler cannot
remote:        continue.
remote:        Make sure that `gem install sqlite3 -v '1.3.11'` succeeds before bundling.
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !     
remote:  !     Detected sqlite3 gem which is not supported on Heroku.
remote:  !     https://devcenter.heroku.com/articles/sqlite3
remote:  !
remote: 
remote:  !     Push rejected, failed to compile Ruby app
remote: 
remote: Verifying deploy...
remote: 
remote: !   Push rejected to pockettheskimm.
remote: 
To https://git.heroku.com/pockettheskimm.git
 ! [remote rejected] master -> master (pre-receive hook declined)

我随后阅读了关于Heroku的文档,它告诉我必须在我的应用程序中使用Postgres而不是sqlite3.所以我更新了我的应用程序,为Postgres交换了sqlite3:

default: &default
  adapter: postgresql
  pool: 5
  timeout: 5000

development:
  <<: *default
  database: db/development.postgresql

# 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:
  <<: *default
  database: db/test.postgresql

production:
  <<: *default
  database: db/production.postgresql

但现在当我在本地运行应用程序时,我在浏览器中收到此错误:

ActiveRecord::NoDatabaseError
FATAL: database "db/development.postgresql" does not exist

Extracted source (around line #661):
659
660
661
662
663
664

        rescue ::PG::Error => error
          if error.message.include?("does not exist")
            raise ActiveRecord::NoDatabaseError.new(error.message, error)
          else
            raise
          end

我该怎么做才能解决这个问题?



1> Mr. Rene..:

这是对我有用的答案:

" rake db:create && rake db:migrate在更改database.yml配置文件后,您是否继续进行开发?"

归功于/sf/ask/17360801/

推荐阅读
吻过彩虹的脸_378
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有