# Error nach UPDATE

**URL:** <https://forum.shopware.com/t/error-nach-update/71416>\
**Category:** Allgemein\
**Created:** [7. Dezember 2020 um 17:32 UTC](https://forum.shopware.com/t/error-nach-update/71416 "2020-12-07T17:32:49Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![KITS](https://avatars.discourse-cdn.com/v4/letter/k/cab0a1/32.png) [@KITS](https://forum.shopware.com/u/KITS)\
**Post date:** [7. Dezember 2020 um 17:32 UTC](https://forum.shopware.com/t/error-nach-update/71416/1 "2020-12-07T17:32:49Z")

</div>

Ich bekomme in dem Updater von Shopware 6 folgende Error-Meldung:

&nbsp;

Error

Received the following error message:  
An exception occurred while executing ’ ALTER TABLE `theme` ADD FOREIGN KEY `fk.theme.preview_media_id`(preview\_media\_id) REFERENCES media(id) ON UPDATE CASCADE ON DELETE SET NULL; ': SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (\*\*\*\*\*\*\*.`#sql-674_43f68`, CONSTRAINT `#sql-674_43f68_ibfk_1` FOREIGN KEY (`preview_media_id`) REFERENCES `media` (`id`) ON DELETE SET NULL ON UPDATE CASCADE)

Please try to fix this error and restart the update.

Response

```
 {"valid":false,"errorMsg":"An exception occurred while executing '\n ALTER TABLE `theme`\n ADD FOREIGN KEY `fk.theme.preview_media_id`(preview\_media\_id) REFERENCES media(id)\n ON UPDATE CASCADE\n ON DELETE SET NULL;\n ':\n\nSQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (` ************ CONSTRAINT `\*\*\*\*\*\*\*\*\*\*` FOREIGN KEY (`preview\_media\_id`) REFERENCES `media` (`id`) ON DELETE SET NULL ON UPDATE CASCADE)"}

```

Ich bin durch ähnliche Probleme, die ich in dem Forum gefunden habe schon dazu gekommen, dass es sich wohl um ein SQL Problem handelt und ich meine Datenbanken mit irgendeinem Befehl manuell ändern muss. Da ich mich mit SQL leider garnicht auskenne meine Frage ob mir da einer bei helfen kann? Vielleicht hatte ja jemand das gleiche Problem.&nbsp;

&nbsp;

Vielen Dank und schöne Festtage!

&nbsp;

---

<div class="post-metadata">

**Author:** ![needful](https://avatars.discourse-cdn.com/v4/letter/n/c68b51/32.png) [@needful](https://forum.shopware.com/u/needful)\
**Post date:** [7. Dezember 2020 um 20:45 UTC](https://forum.shopware.com/t/error-nach-update/71416/2 "2020-12-07T20:45:47Z")

</div>

Hi!

&nbsp;

Bin eben auch darüber gestolpert, bei mir reichte es in meinem eigenen Theme die Media ID des Screenshots zu löschen, auf NULL setzen per phpmyadmin in der theme Tabelle.

&nbsp;

Gruß

&nbsp;

Marco

---

<div class="post-metadata">

**Author:** ![nemoment](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@nemoment](https://forum.shopware.com/u/nemoment)\
**Post date:** [8. Dezember 2020 um 11:58 UTC](https://forum.shopware.com/t/error-nach-update/71416/3 "2020-12-08T11:58:52Z")

</div>

Danke, leider hat es bei mir so nicht geklappt.

Bei dem Versuch wird eine weitere (neue) Fehlermeldung erzeugt, die sich auf die Preview ID bezieht.

&nbsp;

Bemerkenswert finde ich, dass bei mir bisher kein Shopware 6 Update fehlerfrei funktioniert hat.

Jedes Mal habe ich mich über mein Backup freuen müssen. Diesmal sogar mehrfach.

&nbsp;

LG! Nemo

> &nbsp;
> 
> &nbsp;
> 
> [@needful schrieb:](https://forum.shopware.com/profile/15080/needful "needful")
> 
> Hi!
> 
> &nbsp;
> 
> Bin eben auch darüber gestolpert, bei mir reichte es in meinem eigenen Theme die Media ID des Screenshots zu löschen, auf NULL setzen per phpmyadmin in der theme Tabelle.
> 
> &nbsp;
> 
> Gruß
> 
> &nbsp;
> 
> Marco

---

<div class="post-metadata">

**Author:** ![tarkka.ch](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/tarkka.ch/32/13452_2.png) [@tarkka.ch](https://forum.shopware.com/u/tarkka.ch)\
**Post date:** [8. Dezember 2020 um 12:32 UTC](https://forum.shopware.com/t/error-nach-update/71416/4 "2020-12-08T12:32:40Z")

</div>

Diese Seite schon mal durchgelesen?

> **[Shopware 5 - Tutorials & FAQs - Reparatur der Foreign Keys](https://docs.shopware.com/de/shopware-5-de/tutorials-und-faq/foreign-keys-reparieren)**

---

<div class="post-metadata">

**Author:** ![Moritz\_Naczenski](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/moritz_naczenski/32/7792_2.png) [@Moritz\_Naczenski](https://forum.shopware.com/u/Moritz_Naczenski)\
**Post date:** [8. Dezember 2020 um 15:04 UTC](https://forum.shopware.com/t/error-nach-update/71416/5 "2020-12-08T15:04:58Z")

</div>

```
UPDATE `theme` SET preview_media_id = NULL WHERE preview_media_id NOT IN (SELECT id FROM media);

```

Danach das Update nochma starten.

---

<div class="post-metadata">

**Author:** ![nemoment](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@nemoment](https://forum.shopware.com/u/nemoment)\
**Post date:** [9. Dezember 2020 um 07:32 UTC](https://forum.shopware.com/t/error-nach-update/71416/6 "2020-12-09T07:32:31Z")

</div>

> [@Moritz Naczenski schrieb:](https://forum.shopware.com/profile/14574/Moritz%20Naczenski "Moritz%20Naczenski")
> 
> UPDATE `theme` SET preview\_media\_id = NULL WHERE preview\_media\_id NOT IN (SELECT id FROM media);
> 
> Danach das Update nochma starten.

Vielen Dank!&nbsp;

---

<div class="post-metadata">

**Author:** ![Skudderia](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/skudderia/32/18053_2.png) [@Skudderia](https://forum.shopware.com/u/Skudderia)\
**Post date:** [10. Dezember 2020 um 07:56 UTC](https://forum.shopware.com/t/error-nach-update/71416/7 "2020-12-10T07:56:58Z")

</div>

Ich habe das gleiche Problem und kenne mich ÜBERHAUPT nicht aus. kann mir jemand sagen, WAS GENAU ich tun muss?

Error

Received the following error message:  
An exception occurred while executing ’ ALTER TABLE `theme` ADD FOREIGN KEY `fk.theme.preview_media_id`(preview\_media\_id) REFERENCES media(id) ON UPDATE CASCADE ON DELETE SET NULL; ': SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`c4339w8749db1`.`#sql-ce3_1bbbcd6`, CONSTRAINT `fk.theme.preview_media_id` FOREIGN KEY (`preview_media_id`) REFERENCES `media` (`id`) ON DELETE SET NULL ON UPDATE CASCADE)

Please try to fix this error and restart the update.

Response

```
 {"valid":false,"errorMsg":"An exception occurred while executing '\n ALTER TABLE `theme`\n ADD FOREIGN KEY `fk.theme.preview_media_id`(preview\_media\_id) REFERENCES media(id)\n ON UPDATE CASCADE\n ON DELETE SET NULL;\n ':\n\nSQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`c4339w8749db1`.`#sql-ce3_1bbbcd6`, CONSTRAINT `fk.theme.preview_media_id` FOREIGN KEY (`preview_media_id`) REFERENCES `media` (`id`) ON DELETE SET NULL ON UPDATE CASCADE)"}
```

---

<div class="post-metadata">

**Author:** ![ThomasChr](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/thomaschr/32/10466_2.png) [@ThomasChr](https://forum.shopware.com/u/ThomasChr)\
**Post date:** [10. Dezember 2020 um 08:05 UTC](https://forum.shopware.com/t/error-nach-update/71416/8 "2020-12-10T08:05:37Z")

</div>

Du öffnest phpmyadmin (welches dir dein Hoster meistens zur Verfügung stellt) gehst auf die Datenbank, gehst auf SQL und tippstden Update von Moritz ein:

```
UPDATE `theme` SET preview_media_id = NULL WHERE preview_media_id NOT IN (SELECT id FROM media);

```

&nbsp;

---

<div class="post-metadata">

**Author:** ![Skudderia](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/skudderia/32/18053_2.png) [@Skudderia](https://forum.shopware.com/u/Skudderia)\
**Post date:** [10. Dezember 2020 um 09:10 UTC](https://forum.shopware.com/t/error-nach-update/71416/9 "2020-12-10T09:10:15Z")

</div>

> [@ThomasChr schrieb:](https://forum.shopware.com/profile/26204/ThomasChr "ThomasChr")
> 
> Du öffnest phpmyadmin (welches dir dein Hoster meistens zur Verfügung stellt) gehst auf die Datenbank, gehst auf SQL und tippstden Update von Moritz ein:
> 
> UPDATE `theme` SET preview\_media\_id = NULL WHERE preview\_media\_id NOT IN (SELECT id FROM media);
> 
> &nbsp;
> 
> &nbsp;
> 
> OOOKay… ich versuch mal
> 
> &nbsp;

---

<div class="post-metadata">

**Author:** ![StefanJoachim](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@StefanJoachim](https://forum.shopware.com/u/StefanJoachim)\
**Post date:** [11. Dezember 2020 um 07:38 UTC](https://forum.shopware.com/t/error-nach-update/71416/10 "2020-12-11T07:38:13Z")

</div>

Bei mir tritt das Problem auch auf, wenn ich den MySQL Befehl anwende bleibt der Fehler bestehen.

---

<div class="post-metadata">

**Author:** ![StefanJoachim](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@StefanJoachim](https://forum.shopware.com/u/StefanJoachim)\
**Post date:** [11. Dezember 2020 um 07:41 UTC](https://forum.shopware.com/t/error-nach-update/71416/11 "2020-12-11T07:41:34Z")

</div>

Oha, wer lesen kann ist klar im Vorteil!

Ihr müsst an ALLEN Themes ein Vorschaubild anhängen, dann funktioniert das Update!

&nbsp;

---

<div class="post-metadata">

**Author:** ![Gladmin](https://avatars.discourse-cdn.com/v4/letter/g/439d5e/32.png) [@Gladmin](https://forum.shopware.com/u/Gladmin)\
**Post date:** [13. Dezember 2020 um 19:07 UTC](https://forum.shopware.com/t/error-nach-update/71416/12 "2020-12-13T19:07:22Z")

</div>

Hallo, ich hatte dasselbe Problem während des Updates auf 6.3.4.0.

Nachdem ich folgenden MySQL Befehl durchgeführt habe lief das Update durch.

```
UPDATE `theme` SET preview_media_id = NULL WHERE preview_media_id NOT IN (SELECT id FROM media)

```

`Nach Ferstigstellung des Updates erhalte ich allerdings folgenden Fehler und keinen Zugriff mehr auf das Front und Backend:`

**Fatal error** : Trait ‘Shopware\Core\Framework\DataAbstractionLayer\EntityIdTrait’ not found in **/www/htdocs/wXXXX/XXXX/shop/vendor/shopware/core/System/SystemConfig/SystemConfigEntity.php** on line **11**

Habt Ihr hier einen Tip für mich?

Besten Dank

Gladmin

&nbsp;
