【问题标题】:Codeship build failing with NoDatabaseErrorCodeship 构建失败并出现 NoDatabaseError
【发布时间】:2017-04-19 09:35:09
【问题描述】:

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

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 文件

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

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

RAILS_ENV=test bundle exec rake
RAILS_ENV=test bundle exec rspec

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

【问题讨论】:

    标签: ruby-on-rails codeship


    【解决方案1】:

    尝试运行bundle exec rake db:create:all 其次是bundle exec rake db:migrate 它可能失败了,因为你忘记了“全部”

    【讨论】:

    • 感谢您的快速回复,但不会改变任何事情
    猜你喜欢
    • 1970-01-01
    • 2021-11-11
    • 2020-05-07
    • 1970-01-01
    • 1970-01-01
    • 2023-03-22
    • 2013-12-05
    • 2019-09-23
    • 2020-03-27
    相关资源
    最近更新 更多