# Upgrade schlägt fehl bei dupliziertem Schlüssel-Fehler ("Index, um hotlinked Media auf post id und url md5 zu indexieren")

**URL:** https://meta.discourse.org/t/upgrade-fails-on-duplicate-key-error-index-post-hotlinked-media-on-post-id-and-url-md5/226002
**Category:** Bug
**Created:** [3. Mai 2022 um 15:34 UTC](https://meta.discourse.org/t/upgrade-fails-on-duplicate-key-error-index-post-hotlinked-media-on-post-id-and-url-md5/226002 "2022-05-03T15:34:51Z")
**Posts on this page:** 1
**Showing post:** 10

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [3. Mai 2022 um 21:30 UTC](https://meta.discourse.org/t/upgrade-fails-on-duplicate-key-error-index-post-hotlinked-media-on-post-id-and-url-md5/226002/10 "2022-05-03T21:30:53Z")

</div>

> [@axfelix](#):
>
> die erste Korrektur hat funktioniert

Großartig, danke für die Bestätigung!

> [@pfaffman](#):
>
> aber wenn ich ein Backup wiederherstelle

Ich habe einen PR mit einer Korrektur dafür geöffnet:

> <https://github.com/discourse/discourse/pull/16624>
>
> c1db9687 introduced an postgres enum type. Our database restore logic did not ha…ndle custom types correctly, and would therefore raise a 'type already exists' error when restoring any backup.
> 
> This commit adds restore handling for enums, mirroring the similar logic for tables and views.
> 
> \---
> 
> (This code is not tested by rspec, but it is tested by a regular internal job at CDCK, which correctly picked up on this issue)

---

_[View the full topic](https://meta.discourse.org/t/upgrade-fails-on-duplicate-key-error-index-post-hotlinked-media-on-post-id-and-url-md5/226002)._
