Unable to load Rails schema on Postgres in Heroku

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Unable to load Rails schema on Postgres in Heroku



I can't figure out why my db:schema:load is failing on Heroku. Below are the details.


db:schema:load


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'



I am on Rails 5.2, Postgres 10, pg gem 1.0.





Please read Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers? - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions.
– halfer
Aug 6 at 19:21





Looks like you have a statement timeout. Are you configuring that in database.yml?
– Adam McCrea
Aug 7 at 11:46


database.yml




1 Answer
1



It turns out that Heroku has timeouts for such statements by default when executing their commands. Enabling the POSTGIS extension manually from the console allowed rest of the schema to be loaded without a problem.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS