Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Robbie van den Hoven 36 posts 181 karma points
    Feb 15, 2018 @ 14:25
    Robbie van den Hoven
    0

    Upgrade from 7.7.11 to 7.8.X database missing keys FK_cmsMedia_cmsContent_nodeId

    When I upgrade (Nuget) from version 7.7.11 to 7.8.# I get an Error during installation. The database is in an earlier stage moved via script but I haven't had any problems with that before.

    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.

  • Ben McKean 272 posts 549 karma points
    Feb 16, 2018 @ 16:18
    Ben McKean
    0

    I've also had this same issue but upgrading from 7.7.9 to 7.8.1

  • Ben McKean 272 posts 549 karma points
    Feb 19, 2018 @ 10:24
    Ben McKean
    0

    My tests so far have been:

    • Upgrade from 7.7.9 to 7.7.11 - All good
    • Upgrade from 7.7.11 to 7.8.1 - No good, same error
    • Upgrade from 7.7.11 to 7.8.0 - No good, same error
  • Ben McKean 272 posts 549 karma points
    Feb 19, 2018 @ 10:48
    Ben McKean
    0

    Issue created for this here http://issues.umbraco.org/issue/U4-10983

  • Ben McKean 272 posts 549 karma points
    Feb 19, 2018 @ 12:42
    Ben McKean
    0

    I've managed to fix this for my site. The issue was one of the indexes was "Non-unique" whereas it needed to be unique. I updated this by scripting out the index for a site which had the index as "unique", ran the upgrade and it all worked.

  • Benjamin Ravn 35 posts 68 karma points
    Feb 20, 2018 @ 12:08
    Benjamin Ravn
    0

    Can you please be a little more specific about how you solved the problem? I'm not exactly sure what to do.

  • Benjamin Ravn 35 posts 68 karma points
    Feb 21, 2018 @ 08:32
    Benjamin Ravn
    0

    It worked btw! Thank you :-)

  • Ben McKean 272 posts 549 karma points
    Feb 20, 2018 @ 12:17
    Ben McKean
    1

    Hi Benjamin,

    All info can be found on the issue http://issues.umbraco.org/issue/U4-10983

    I basically deleted the existing index and then from a working site, scripted out the index and recreated it in my site.

    Thanks

    Ben

  • Lars Nederberg 29 posts 84 karma points
    Feb 21, 2018 @ 08:25
    Lars Nederberg
    1

    Hi, I ran this sql query manually:

    CREATE TABLE [cmsMedia] ([nodeId] INTEGER NOT NULL, [versionId] UniqueIdentifier NOT NULL, [mediaPath] NVARCHAR(255) NULL)

    After that installation ran without errors.

    That worked for me.

    / Lars

  • Robbie van den Hoven 36 posts 181 karma points
    Feb 22, 2018 @ 10:12
    Robbie van den Hoven
    107

    I also managed to fix this on my site. Ben put me in the right direction. Except my database has no ‘Non-Clusterd’ indexes at all. Perhaps they got lost by a previous action of scripting the database.

    What I (also) did was installing a clean version of 7.8.#. Then (in SQL Server Management Studio) go to the Index of the ‘cmsContent’ table. On the ‘IX_cmsContent (Unique, Non-Clusterd)’ index right-click ‘Script Index as -> CREATE To -> New Query Editor Window’.

    Execute this SQL script on your site database (USE [yourSiteDatabase]).

    After running the site (umbraco instalation) again, I don’t get any errors :-)

    Note: the ‘cmsMedia’ table is created during the installation. You don’t need to create this by yourself.

    USE [yourDatabasename]
    GO
    
    CREATE UNIQUE NONCLUSTERED INDEX [IX_cmsContent] ON [dbo].[cmsContent]
    (
        [nodeId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    
  • Russell Cavell 3 posts 74 karma points
    Jul 16, 2018 @ 09:28
    Russell Cavell
    0

    Thank you Robbie!

    I was getting the same error when upgrading 7.7.7 to 7.11.1 and that SQL script worked perfectly as described.

    Cheers,

    Russ.

  • Jon Davis 16 posts 109 karma points
    Feb 20, 2022 @ 14:19
    Jon Davis
    0

    I ran into this issue when upgrading to v7.8.0. My fix was slightly different. Somehow there were two entries in the cmsContent table with the same nodeId, which corrupted the IX_cmsContent index. Ran the following query to find the duplicate:

    select nodeId, COUNT(pk) from cmsContent cc group by cc.nodeId havinG COUNT(pk) > 1

    Both entries referenced the same UmbracoNode, so I deleted the second entry. Then I rebuilt the index and ran the update and it went through fine.

Please Sign in or register to post replies

Write your reply to:

Draft