An exception has occured - custom attribute

Permalink 1 user found helpful
Hi all,

I have migrated from XAMPP to hosted solution (linux) and have started getting the following error message whenever I try to add an image via a custom thumbnail attribute:

An exception occurred while executing 'INSERT INTO atFile (fID, avID) VALUES (?, ?)' with params [1, 7394]: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`nextcode_wildtech`.`atFile`, CONSTRAINT `FK_73D17D61E3111F45` FOREIGN KEY (`fID`) REFERENCES `files` (`fID`) ON DELETE CASCADE)

I can add images to a page using the content block etc but for some reason this issue is popping up with the custom page attribute.

Looking at the error I see that REFERENCES `files` (`fID`) is the wrong case for the Files table but I'm not sure where that call is coming from.

Any help would be greatly appreciated.


View Replies: View Best Answer
Gondwana replied on at Permalink Best Answer Reply
I suspect ur on the right track. By default xampp on windows doesnt create case sensitive databases. Theres a script here somewhere that converts table name caps but i think there can still be problems with foreign keys.
mobius2000 replied on at Permalink Reply
I ended up having to do a fresh install from scratch as it appears the foreign key constraints issue was in numerous places within my dev site due to installing it initially on on XAMPP and then moving up to Linux based production server.

Seems to be a big issue all of a sudden according to a number of threads, I'm curious if anyone has a definitive way of getting around this?
Gondwana replied on at Permalink Reply
Once I configured XAMPP's MariaDB to the appropriate case sensitivity setting (prior to installing c5), I haven't had any problems moving c5 sites from Windows to linux. It may also depend on exactly how you export the database.