# Problem with rebuild Discourse at Docker

**URL:** https://meta.discourse.org/t/problem-with-rebuild-discourse-at-docker/220442
**Category:** Self-hosting
**Created:** [March 8, 2022, 5:31pm UTC](https://meta.discourse.org/t/problem-with-rebuild-discourse-at-docker/220442 "2022-03-08T17:31:42Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Robert\_Work](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@Robert\_Work](https://meta.discourse.org/u/Robert_Work)
#### Post date: [March 8, 2022, 5:31pm UTC](https://meta.discourse.org/t/problem-with-rebuild-discourse-at-docker/220442/1 "2022-03-08T17:31:42Z")

</div>

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:

```plaintext
...
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)](https://review.discourse.org/t/dev-drop-bookmark-trigger-correctly-15486/29528)

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

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [March 8, 2022, 5:46pm UTC](https://meta.discourse.org/t/problem-with-rebuild-discourse-at-docker/220442/2 "2022-03-08T17:46:16Z")

</div>

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](https://meta.discourse.org/t/postgresql-13-update/172563)

---

<div class="post-metadata">

### Author: ![Robert\_Work](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@Robert\_Work](https://meta.discourse.org/u/Robert_Work)
#### Post date: [March 9, 2022, 7:35am UTC](https://meta.discourse.org/t/problem-with-rebuild-discourse-at-docker/220442/3 "2022-03-09T07:35:04Z")

</div>

Hi Rafael,

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

---

<div class="post-metadata">

### Author: ![fitzy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fitzy/32/192549_2.png) [@fitzy](https://meta.discourse.org/u/fitzy)
#### Post date: [March 10, 2022, 11:07pm UTC](https://meta.discourse.org/t/problem-with-rebuild-discourse-at-docker/220442/4 "2022-03-10T23:07:22Z")

</div>

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

i.e. using

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

```

rather than

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

```

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