U4-10983 - Upgrade from 7.7 to 7.8 db error The database failed to upgrade There are no primary or candidate keys in the referenced table 'cmsContent'...

Created by Ben McKean 19 Feb 2018, 10:48:15 Updated by Asbjørn Riis-Knudsen 13 Mar 2018, 10:31:19

'''What did you do?''' Attempted to upgrade a site from 7.7.9 to 7.8.1

'''What did you expect to happen?''' The upgrade to work successfully with no errors

'''What actually happened?''' The upgrade did not complete and I received the following error: The database failed to upgrade. ERROR: The database configuration failed with the following message: There are no primary or candidate keys in the referenced table 'cmsContent' that match the referencing column list in the foreign key 'FK_cmsMedia_cmsContent_nodeId'. Could not create constraint or index. See previous errors. Please check log file for additional information (can be found in '/App_Data/Logs/UmbracoTraceLog.txt')

I've attached the log file.

I've also attempted to: upgrade to 7.7.11 - this worked fine upgrade to 7.8.0 - Same error

4 Attachments

Download UmbracoTraceLog.BENMCKEANBA53.txt


Ben McKean 19 Feb 2018, 11:11:18

I've checked in the DB and the cmsMedia table has not been created so presume this is all in a transaction scope and has rolled back that change or....the cmsMedia table just hasn't been created for some reason

Ben McKean 19 Feb 2018, 12:41:37

I think I've resolved the issue although it'd still be good for somebody at HQ to confirm or perhaps put something to handle this in code. I spun up a blank instance of 7.7.9 and upgrade to 7.8.1 with no issues. Therefore it was something to do with my DB. I compared the DBs to see what the differences were.

In my instance, the index on my DB for the cmsContent table was different to that on a blank instance, specifically, it was "Non-unique". I've attached the screenshot differences. So to fix I deleted the index on my DB and recreated as per the blank instance and all ran ok.

Asbjørn Riis-Knudsen 13 Mar 2018, 10:31:19

Just hit this as well, upgrading from 7.5.11 to 7.9.2

Priority: Normal

Type: Bug

State: Submitted


Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions: 7.7.9, 7.7.10

Due in version:


Story Points: