Docker 重建 Discourse 的问题

您好,

我遇到了更新问题。当我在 admin/upgrade 页面尝试更新 Discourse 时,会收到有关旧 Docker 镜像的信息。

因此,我尝试连接到 Discourse 服务器并通过键入命令 git pull 然后重建应用程序来更新。但现在我收到了以下错误:

...
成功清除缓存。
耗时 8.44 秒。

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'

我尝试在注释掉插件部分的情况下更新 Discourse。但这没有帮助。

在 discourse 中搜索关于 sync_bookmarks_polymorphic_column_data 这个函数,我只找到了 Discourse 代码中的这个更改 DEV: Drop bookmark trigger correctly (#15486)

我可以在哪里找到更多关于发生了什么的信息?或者如何尝试在不进行上述更改的情况下重建 Discourse?

您是否通过在 app.yml 中强制使用旧版本数据库而跳过了 PostgreSQL 升级?

恐怕您需要按照 PostgreSQL 13 更新 来更新到我们支持的版本。

3 个赞

您好 Rafael,

问得好!我该如何跳过 PostgreSQL 升级?app.yml 中是否有我可用的属性列表?

1 个赞

如果使用带有版本号的特定 Postgresql 模板,这将跳过升级。
例如,使用

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

而不是

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

会将 Postgres 固定到版本 12,而不是当前的 PG 13 的“最新”版本。