我不知道为什么我的db:schema:load
在Heroku上失败了。下面是详细信息。
heroku run rails db:schema:load --app appna DISABLE_DATABASE_ENVIRONMENT_CHECK=1 RAILS_ENV=production
Running rails db:schema:load DISABLE_DATABASE_ENVIRONMENT_CHECK=1 RAILS_ENV=production on ⬢ appname... up, run.3508 (Standard-1X)
This method is not allowed with this Ruby version. current: 2.5.1, allowed version: < 2.5.0
-- enable_extension("plpgsql")
D, [2018-08-06T00:12:27.213314 #4] DEBUG -- : SQL (2.8ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
D, [2018-08-06T00:12:27.229821 #4] DEBUG -- : ↳ db/schema.rb:16
-> 0.1128s
-- enable_extension("postgis")
D, [2018-08-06T00:12:27.497698 #4] DEBUG -- : SQL (256.9ms) CREATE EXTENSION IF NOT EXISTS "postgis"
D, [2018-08-06T00:12:27.501310 #4] DEBUG -- : ↳ db/schema.rb:17
rails aborted!
ActiveRecord::QueryCanceled: PG::QueryCanceled: ERROR: canceling statement due to statement timeout
: CREATE EXTENSION IF NOT EXISTS "postgis"
/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.0/lib/active_record/connection_adapters/postgresql_adapter.rb:603:in `async_exec'
我在Rails 5.2,Postgres 10,pg gem 1.0上。
答案 0 :(得分:0)
事实证明,Heroku在执行它们的命令时默认情况下会超时。通过控制台手动启用POSTGIS扩展,可以加载其余模式,而不会出现问题。