CodeD构建因NoDatabaseError而失败

时间:2017-04-19 09:35:10

标签: ruby-on-rails codeship

我的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

任何想法为什么要引用开发数据库?提前致谢

1 个答案:

答案 0 :(得分:0)

尝试运行bundle exec rake db:create:all 然后是bundle exec rake db:migrate 它可能失败了,因为你忘记了'全部'