Broken upgrade

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?

1 Like

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.