# 升级 2.7 到 3.1 失败："hotlinked\_media\_status" 已存在

**URL:** <https://meta.discourse.org/t/upgrading-2-7-to-3-1-failing-hotlinked-media-status-already-exists/277313>\
**Category:** Self-hosting\
**Created:** [2023年八月31日 08:44 UTC](https://meta.discourse.org/t/upgrading-2-7-to-3-1-failing-hotlinked-media-status-already-exists/277313 "2023-08-31T08:44:32Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
**Post date:** [2023年八月31日 09:05 UTC](https://meta.discourse.org/t/upgrading-2-7-to-3-1-failing-hotlinked-media-status-already-exists/277313/5 "2023-08-31T09:05:28Z")

</div>

这很可能是迁移问题：

> <https://github.com/discourse/discourse/blob/253d4a154c0f8e177fe75c95ef4a1017d8ddf3e2/db/migrate/20220428094026_create_post_hotlinked_media.rb#L7>

理想情况下，它应该首先检查类型是否存在？

- 一种选择是尝试从命令行向后运行该迁移：

- 另一种选择是进入数据库并手动从 `pg_type` 表中删除该类型，然后重建。但这可能风险更大，因为您将与迁移不同步。

---

_[View the full topic](https://meta.discourse.org/t/upgrading-2-7-to-3-1-failing-hotlinked-media-status-already-exists/277313)._
