2017-04-19 79 views
0

的建立为我的Rails应用程序,下面的错误是失败上运行测试Codeship建立与NoDatabaseError失败

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 

为什么开发数据库被引用的任何想法?在此先感谢

回答

0

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

+0

感谢您的快速响应,但是,它不会改变任何东西 –