# Foreign key constraint error in phpmyadmin

**URL:** <https://forum.shopware.com/t/foreign-key-constraint-error-in-phpmyadmin/92378>\
**Category:** Shopware 6 (English)\
**Created:** [14. Januar 2022 um 18:10 UTC](https://forum.shopware.com/t/foreign-key-constraint-error-in-phpmyadmin/92378 "2022-01-14T18:10:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aydin](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/aydin/32/15834_2.png) [@aydin](https://forum.shopware.com/u/aydin)\
**Post date:** [14. Januar 2022 um 18:10 UTC](https://forum.shopware.com/t/foreign-key-constraint-error-in-phpmyadmin/92378/1 "2022-01-14T18:10:41Z")

</div>

Hi,

I’m trying to edit a user comment thru PHPMyAdmin but it gives me this error:

> ```auto
> UPDATE `product_review` SET `product_id` = 0x61507f15533140d8acf164553d71c5d41, `customer_id` = 0x07dbc372228f42dca7b8bb5615e9bfe31, `sales_channel_id` = 0x9bcd4e53fc294760b5964a5471c2275c1, `language_id` = 0x2fbb5fe2e29a4d70aa5854ce7ce3e20b1, `product_version_id` = 0x0fa91ce3e96a4bc2be4bd9ce752c34251 WHERE `product_review`.`id` = CAST(0xf5589c39c8f74b46a1c5ddf80204eb61 AS BINARY)
> 
> ```
> 
> `#1452 - Cannot add or update a child row: a foreign key constraint fails (`aadb1`.`product\_review`, CONSTRAINT `fk.product\_review.product\_id` FOREIGN KEY (`product\_id`, `product\_version\_id`) REFERENCES `product` (`id`, `version\_id`) ON DELETE CASCADE ON UPD)`

Any solution to this?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![aydin](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/aydin/32/15834_2.png) [@aydin](https://forum.shopware.com/u/aydin)\
**Post date:** [14. Januar 2022 um 19:48 UTC](https://forum.shopware.com/t/foreign-key-constraint-error-in-phpmyadmin/92378/2 "2022-01-14T19:48:52Z")

</div>

Hi all

I just dropped the constraint from the table structure, now I can update the user reviews as I wish.

Can I leave like this or should I add the constraints?

> ALTER TABLE `product_review`  
> ADD CONSTRAINT `fk.product_review.customer_id` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,  
> ADD CONSTRAINT `fk.product_review.language_id` FOREIGN KEY (`language_id`) REFERENCES `language` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,  
> ADD CONSTRAINT `fk.product_review.product_id` FOREIGN KEY (`product_id`,`product_version_id`) REFERENCES `product` (`id`, `version_id`) ON DELETE CASCADE ON UPDATE CASCADE,  
> ADD CONSTRAINT `fk.product_review.sales_channel_id` FOREIGN KEY (`sales_channel_id`) REFERENCES `sales_channel` (`id`);  
> COMMIT;
