Umbraco-CMS: Database migration failing from umbraco 7.15 to 8.18.3

Which exact Umbraco version are you using? For example: 9.0.1 - don’t just write v9

8.18.3

Bug summary

When migrating from 7.15.1 to 8.18.3 the upgrade fails when it tried to re-create all indexes and keys. The list of indexes to process also includes the table ContentVersionCleanupPolicyDto which doesn’t exist yet since it’s a feature (and table) added in 8.18.

the error we get is

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Umbraco.Web.Install.InstallException: The database failed to upgrade. ERROR: The database configuration failed with the following message: Cannot find the object \"umbracoContentVersionCleanupPolicy\" because it does not exist or you do not have permissions

Specifics

No response

Steps to reproduce

Migrate from 7.15.1 to 8.18.3

Expected result / actual result

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (17 by maintainers)

Most upvoted comments

@p-m-j Just so that’s clear in my mind, the intention is to be able to migrate from 7.x to 8.0 to 9.0 to 10.x ? That would sound fine to me. I have quite a number of v7 sites on Cloud and clients who don’t want me to change anything - it ain’t broke so don’t fix it. However, eventually the day will come, and I need to be ready for it.

I have been busy over the last couple years migrating v7 sites to vLatest, and foresee that continuing for some time to come. I don’t mind having to go through all the major versions (7-latest, 8-latest, 9-latest…), but ideally I wouldn’t have to ALSO go through various interim versions to manage these annoying DB issues.

I came across this one today while going from 7.15.7 to 8.18.3. (Fresh v8.18.3 site pointing to SQL DB for v7 site)

I used NuGet to install @p-m-j 's provided update, rebuilt, and ran the upgrade wizard again - and SUCCESS! Thank you so much, @p-m-j !!!

Thx @p-m-j for the fix. I trust @hfloyd judgement since she got into the same issue with her migration. Glad to see it works!

@p-m-j I can try, but logging off for the week now. Can try next week

it might be enough to update CreateKeysAndIndexes to explictly re-create only for tables altered by DeleteKeysAndIndexes.cs but really the migration should be absolutely explicit about which indexes and keys are to be created.

e.g. this may be enough

public class CreateKeysAndIndexes : MigrationBase
{
    ....
    
    protected override void Migrate()
    {
        // remove those that may already have keys
        Delete.KeysAndIndexes(Cms.Core.Constants.DatabaseSchema.Tables.KeyValue).Do();
        Delete.KeysAndIndexes(Cms.Core.Constants.DatabaseSchema.Tables.PropertyData).Do();

        // re-create *all* keys and indexes for tables explicitly

        Create.KeysAndIndexes<ContentDto>();
        Create.KeysAndIndexes<ContentTypeDto>();
        ...
        ...
        ...
    }
}