# Upgrading 2.7 to 3.1 failing: "hotlinked\_media\_status" already exists

**URL:** https://meta.discourse.org/t/upgrading-2-7-to-3-1-failing-hotlinked-media-status-already-exists/277313
**Category:** Self-hosting
**Created:** [August 31, 2023, 8:44am 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:** 11
**Page:** 2

<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: [August 31, 2023, 11:47am UTC](https://meta.discourse.org/t/upgrading-2-7-to-3-1-failing-hotlinked-media-status-already-exists/277313/21 "2023-08-31T11:47:52Z")

</div>

This only occurred when you imported your backup? (to your brand new, freshly and successfully built error-free 3.1 stable server?)

---

<div class="post-metadata">

### Author: ![Hotfirenet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hotfirenet/32/120124_2.png) [@Hotfirenet](https://meta.discourse.org/u/Hotfirenet)
#### Post date: [August 31, 2023, 11:50am UTC](https://meta.discourse.org/t/upgrading-2-7-to-3-1-failing-hotlinked-media-status-already-exists/277313/22 "2023-08-31T11:50:46Z")

</div>

> [@merefield](#):
>
> This only occurred when you imported your backup?

Yes

 ![image](https://global.discourse-cdn.com/meta/original/4X/f/e/c/fec5ba64d78ab0af7b3a472cb0b6f2cdb3a0a646.png)

---

<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: [August 31, 2023, 11:51am UTC](https://meta.discourse.org/t/upgrading-2-7-to-3-1-failing-hotlinked-media-status-already-exists/277313/23 "2023-08-31T11:51:30Z")

</div>

OK, so I’d now start examining the data in your backup.

There was a recent topic about this and it may help.

---

<div class="post-metadata">

### Author: ![Hotfirenet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hotfirenet/32/120124_2.png) [@Hotfirenet](https://meta.discourse.org/u/Hotfirenet)
#### Post date: [August 31, 2023, 12:22pm UTC](https://meta.discourse.org/t/upgrading-2-7-to-3-1-failing-hotlinked-media-status-already-exists/277313/24 "2023-08-31T12:22:44Z")

</div>

What can i do ?

---

<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: [August 31, 2023, 12:35pm UTC](https://meta.discourse.org/t/upgrading-2-7-to-3-1-failing-hotlinked-media-status-already-exists/277313/25 "2023-08-31T12:35:50Z")

</div>

This was a subject of a fix last year, strangely.

> [@Upgrade fails on duplicate key error ("index post hotlinked media on post id and url md5")](https://meta.discourse.org/t/upgrade-fails-on-duplicate-key-error-index-post-hotlinked-media-on-post-id-and-url-md5/226002/10):
>
> Great, thanks for confirming! I opened a PR with a fix for that one:

@david forgive me for mentioning you, but this is completely relevant to that fix, would you care to chime in here?

---

<div class="post-metadata">

### Author: ![Hotfirenet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hotfirenet/32/120124_2.png) [@Hotfirenet](https://meta.discourse.org/u/Hotfirenet)
#### Post date: [August 31, 2023, 3:20pm UTC](https://meta.discourse.org/t/upgrading-2-7-to-3-1-failing-hotlinked-media-status-already-exists/277313/26 "2023-08-31T15:20:16Z")

</div>

I find solution

```plaintext
DO $$ BEGIN CREATE TYPE hotlinked_media_status AS ENUM('downloaded', 'too_large', 'download_failed', 'upload_create_failed'); EXCEPTION WHEN duplicate_object THEN null; END $$;

```

20220428094026\_create\_post\_hotlinked\_media.rb

---

<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: [August 31, 2023, 3:49pm UTC](https://meta.discourse.org/t/upgrading-2-7-to-3-1-failing-hotlinked-media-status-already-exists/277313/27 "2023-08-31T15:49:41Z")

</div>

You edited the Rails migration within the container and that allowed you to complete the import?

---

<div class="post-metadata">

### Author: ![Hotfirenet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hotfirenet/32/120124_2.png) [@Hotfirenet](https://meta.discourse.org/u/Hotfirenet)
#### Post date: [August 31, 2023, 5:04pm UTC](https://meta.discourse.org/t/upgrading-2-7-to-3-1-failing-hotlinked-media-status-already-exists/277313/28 "2023-08-31T17:04:34Z")

</div>

yes, that’s right

---

<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: [August 31, 2023, 5:26pm UTC](https://meta.discourse.org/t/upgrading-2-7-to-3-1-failing-hotlinked-media-status-already-exists/277313/29 "2023-08-31T17:26:45Z")

</div>

That’s great, well done! 🎉

---

<div class="post-metadata">

### Author: ![Hotfirenet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hotfirenet/32/120124_2.png) [@Hotfirenet](https://meta.discourse.org/u/Hotfirenet)
#### Post date: [September 1, 2023, 10:00am UTC](https://meta.discourse.org/t/upgrading-2-7-to-3-1-failing-hotlinked-media-status-already-exists/277313/30 "2023-09-01T10:00:43Z")

</div>

thanks for your help 🙏

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [October 1, 2023, 10:00am UTC](https://meta.discourse.org/t/upgrading-2-7-to-3-1-failing-hotlinked-media-status-already-exists/277313/31 "2023-10-01T10:00:49Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

[Previous page](https://meta.discourse.org/t/upgrading-2-7-to-3-1-failing-hotlinked-media-status-already-exists/277313.md?page=1)
