首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用NoDatabaseError构建Codeship失败

使用NoDatabaseError构建Codeship失败
EN

Stack Overflow用户
提问于 2017-04-19 17:35:10
回答 1查看 165关注 0票数 1

我的rails应用程序的构建在运行测试时失败,并出现以下错误

代码语言:javascript
复制
9) FailedKeyChecks should contain a value
Failure/Error: ActiveRecord::Base.connection.execute(query)

ActiveRecord::NoDatabaseError:
  FATAL:  database "myapp_development" does not exist

10) User is invalid without name
Failure/Error: raise ActiveRecord::NoDatabaseError.new(error.message, error)

ActiveRecord::NoDatabaseError:
  FATAL:  database "myapp_development" does not exist

我做错了什么?我的codeship.database.yml文件

代码语言:javascript
复制
development:
  adapter: postgresql
  host: localhost
  encoding: unicode
  pool: 10
  username: <%= ENV['PG_USER'] %>
  template: template1
  password: <%= ENV['PGPASSWORD'] %>
  database: development<%= ENV['TEST_ENV_NUMBER'] %>
  port: <%= ENV['DATABASE_PORT'] %>
  sslmode: disable
test:
  adapter: postgresql
  host: localhost
  encoding: unicode
  pool: 10
  username: <%= ENV['PG_USER'] %>
  template: template1
  password: <%= ENV['PGPASSWORD'] %>
  database: test<%= ENV['TEST_ENV_NUMBER'] %>
  port: <%= ENV['DATABASE_PORT'] %>
  sslmode: disable

我的setup commands

代码语言:javascript
复制
rvm use 2.4.1 --install
bundle install
cp codeship.database.yml config/database.yml
export RAILS_ENV=test
bundle exec rake db:create
#bundle exec rake db:migrate
bundle exec rake db:schema:load

还有我的test commands

代码语言:javascript
复制
RAILS_ENV=test bundle exec rake
RAILS_ENV=test bundle exec rspec

你知道为什么要引用开发数据库吗?提前感谢

EN

回答 1

Stack Overflow用户

发布于 2017-04-19 18:14:38

尝试运行bundle exec rake db:create:all,然后运行bundle exec rake db:migrate,它可能会失败,因为您忘记了'all‘

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43491788

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档