Launcher rebuild error -- PG::InvalidSchemaName: ERROR: schema "discourse_functions" does not exist

(Edward Muller) #1

We get the following error when we try to rebuild our discourse image using launcher…

This seems to be related to this commit: FIX: Create `BaseDropper` functions in a different schema. · discourse/discourse@212ee15 · GitHub

I, [2018-09-02T17:08:36.186474 #13] INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' Removing user_profiles column card_image_badge_id rake aborted! PG::InvalidSchemaName: ERROR: schema "discourse_functions" does not exist /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:46:in `eval' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rack-mini-profiler-1.0.0/lib/patches/db/pg.rb:92:in `async_exec' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/mini_sql-0.1.10/lib/mini_sql/connection.rb:114:in `run' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/mini_sql-0.1.10/lib/mini_sql/connection.rb:86:in `exec' /var/www/discourse/lib/migration/column_dropper.rb:57:in `block in execute_drop!' /var/www/discourse/lib/migration/column_dropper.rb:56:in `each' /var/www/discourse/lib/migration/column_dropper.rb:56:in `execute_drop!' /var/www/discourse/lib/migration/base_dropper.rb:17:in `delayed_drop' /var/www/discourse/lib/migration/column_dropper.rb:11:in `drop' (eval):6:in `block (2 levels) in run_file'`

(Edward Muller) #2

I dropped into a psql shell and created the schema and the rebuild seems to be progressing…

(Daniel Kraus) #3

Edward, I have the same issue here. However, I’m not familiar with PG (just MySQL). Would you care to drop a line how to create the schema in the psql shell? Thanks.

(Edward Muller) #4

Once you can get a shell to your postgresql server run the following:

CREATE SCHEMA IF NOT EXISTS discourse_functions;

I hope that helps.

(Sam Saffron) #5

@tgxworld this is odd, why is this happening? Is it fixed now?

(Edward Muller) #6

For some reason (I don’t know why; nor did I have time to troubleshoot further) the discourse_functions schema didn’t exist in my database and the migration logic was trying to do something in/with that schema.

(Sam Saffron) #7

Maybe some weird backup / restore chain of events?

(Alan Tan) #8

Ah the schema may or may not exist depending on when they run the migration. @bovender Can you try rebuilding with the following fix?

I’ve back-ported this back to stable and beta.

(Daniel Kraus) #9

I’m afraid I already created the schema manually and upgraded subsequently without problems.