# Broken upgrade

**URL:** <https://forums.concretecms.org/t/broken-upgrade/2971>\
**Category:** Developing with Concrete\
**Created:** [May 4, 2022, 7:25am UTC](https://forums.concretecms.org/t/broken-upgrade/2971 "2022-05-04T07:25:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TMDesigns](https://forums.concretecms.org/user_avatar/forums.concretecms.org/tmdesigns/32/4261_2.png) [@TMDesigns](https://forums.concretecms.org/u/TMDesigns)\
**Post date:** [May 4, 2022, 7:25am UTC](https://forums.concretecms.org/t/broken-upgrade/2971/1 "2022-05-04T07:25:14Z")

</div>

I have an old site that was on 5.7.5.13 and needs to go on to a box with php7.2 or higher.

I upgraded it to 8.1 and then if I go any further I get this error

### An unexpected error occurred.

An exception occurred while executing ‘INSERT INTO CollectionAttributeValues (cID, cvID, akID, avID) VALUES (?, ?, ?, ?)’ with params [“494”, “1”, 5, null]: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`database_name`.`CollectionAttributeValues`, CONSTRAINT `FK_BB9995FCA2A82A5D` FOREIGN KEY (`avID`) REFERENCES `AttributeValues` (`avID`))

Can anyone help?

---

<div class="post-metadata">

**Author:** ![hutman](https://forums.concretecms.org/user_avatar/forums.concretecms.org/hutman/32/6198_2.png) [@hutman](https://forums.concretecms.org/u/hutman)\
**Post date:** [May 4, 2022, 6:46pm UTC](https://forums.concretecms.org/t/broken-upgrade/2971/2 "2022-05-04T18:46:49Z")

</div>

I’ve run into errors like this before, here is how I solved them.

1. On the command line run `concrete/bin/concrete5 orm:schema-tool:update --dump-sql`
2. In phpMyAdmin or something similar run `SET FOREIGN_KEY_CHECKS=0;`
3. Then copy the output from your CLI and run that
4. Then run `SET FOREIGN_KEY_CHECKS=1;`

Once that’s done you should be able to do your upgrades as you wish.
