Discourse 升级从 3.2.0 到 3.3.0 Postgress 问题

您好!我尝试将我的 Discourse v3.2.0 实例升级到 v3.3.0。在运行数据库迁移时失败了。

Execute db:migrate
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled: (StandardError)
ERROR:  cannot drop column user_id of table invites because other objects depend on it
DETAIL:  trigger invites_user_id_readonly on table invites depends on column user_id of table invites
HINT:  Use DROP ... CASCADE to drop the dependent objects too.

我通过删除数据库中的 3 个触发器解决了这个问题:

DROP TRIGGER invites_user_id_readonly ON invites;

DROP TRIGGER invites_redeemed_at_readonly ON invites;

DROP TRIGGER user_api_keys_scopes_readonly ON user_api_keys;

我的实际问题是,您能否确认这是 Discourse 的错误?你们将来有计划修复它吗?

我正在运行 PostgreSQL 14.10。

已为此问题创建拉取请求。

我将关闭该 PR,因为我无法重现该问题,也没有其他人报告类似问题。

Migration::ColumnDropper.execute_drop 使用 CASCADE 为每个列删除 read_only 函数。这也会删除触发器。

听起来您有一个不引用 read_only 函数的触发器。我不确定您是如何做到的。您使用的是标准安装吗?