Problem with rebuild Discourse at Docker

AI-generated summary

Problem with rebuild Discourse at Docker

Robert_Work is experiencing an issue while updating Discourse via the admin/upgrade page, receiving an error about an old Docker image. After attempting to update manually by running git pull and rebuilding the app, he encounters a PG::SyntaxError related to the sync_bookmarks_polymorphic_column_data function.

Falco suggests that the issue might be due to skipping a PostgreSQL upgrade by forcing an old version of the database in the app.yml file. He recommends updating to the supported version by following the PostgreSQL 13 update guide.

Robert_Work asks how to skip a PostgreSQL upgrade, and fitzy explains that using a specific Postgresql template with a version number in the app.yml file will pin the Postgres to that version, rather than using the ‘latest’ version.

Hello,

I’m forced with an update problem. When I try to update Discourse via admin/upgrade page I receive information about the old Docker image.

So I try to connect to the Discourse server and update by typing the commands git pull and then rebuilding the app. But now I received the below error:

...
success Cleared cache.
Done in 8.44s.

I, [2022-03-08T17:16:03.605966 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'LOAD_PLUGINS=0 bundle exec rake plugin:pull_compatible_all'
I, [2022-03-08T17:16:08.549201 #1]  INFO -- : 
I, [2022-03-08T17:16:08.549823 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

ERROR:  syntax error at or near "CASCADE"
LINE 1: ...ION IF EXISTS sync_bookmarks_polymorphic_column_data CASCADE
                                                                ^
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rack-mini-profiler-3.0.0/lib/patches/db/pg.rb:110:in `exec'
...
/usr/local/bin/bundle:25:in `<main>'

Caused by:
PG::SyntaxError: ERROR:  syntax error at or near "CASCADE"
LINE 1: ...ION IF EXISTS sync_bookmarks_polymorphic_column_data CASCADE
                                                                ^
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rack-mini-profiler-3.0.0/lib/patches/db/pg.rb:110:in `exec'

I tried updating Discourse with commented plugins section. But It didn’t help.

Searching discourse abut sync_bookmarks_polymorphic_column_data this function I only find this change in Discourse code DEV: Drop bookmark trigger correctly (#15486)

Where I can find more information about what happened? Or how to try to rebuild Discourse without the above change?

Did you skip a PostgreSQL upgrade by forcing an old version of the database in your app.yml?

I’m afraid you will need to update to our supported version by following PostgreSQL 13 update

Hi Rafael,

Good question! How I can skip a PostgreSQL upgrade? Is there a list of attributes I can use in app.yml?

If you use a specific Postgresql template with a version number in it, this will skip the upgrade.

i.e. using

templates:
  - "templates/postgres.12.template.yml"

rather than

templates:
  - "templates/postgres.template.yml"

will pin the Postgres to version 12 instead of ‘latest’ which is currently PG 13.