Upgrade 15 to 17.4.0 premigration error

We have an Umbraco 15 site (15.3.1) we are trying to upgrade to 17.4.2.

We upgraded the projects to .NET 10 (along with MS packages) and Umbraco-related packages to 17.

When running the site, it doesn’t try to redirect to the maintenance / upgrade screen, instead it fails to boot with the following error:

An error occurred while running the premigration upgrade. The database configuration failed with the following message: There is already an object named ‘umbracoOpenIddictApplications’ in the database.

The Umbraco log entries before the error are:

{"@mt":"At {OrigState}","OrigState":"{0F49E1A4-AFD8-4673-A91B-F64E78C48174}","SourceContext":"Umbraco.Cms.Infrastructure.Migrations.MigrationPlanExecutor"}
{"@mt":"Execute {MigrationType}","MigrationType":"AddDocumentUrlLock","SourceContext":"Umbraco.Cms.Infrastructure.Migrations.MigrationPlanExecutor"}
{"@mt":"At {OrigState}","OrigState":"{5ECCE7A7-2EFC-47A5-A081-FFD94D9F79AA}"}
{"@mt":"Execute {MigrationType}","MigrationType":"UpdateToOpenIddictV7"}

umbracoKeyValue records before running:

  • Umbraco.Core.Upgrader.State+Umbraco.Core
    {7B11F01E-EE33-4B0B-81A1-F78F834CA45B}

  • Umbraco.Core.Upgrader.State+Umbraco.Core.Premigrations

    {0F49E1A4-AFD8-4673-A91B-F64E78C48174}

After running the site, the Premigration key value changes to
{5ECCE7A7-2EFC-47A5-A081-FFD94D9F79AA}

The umbracoOpenIddictApplications table does exist on 15, so I’m not sure why it’s trying to create it.

We’ve also tried to first upgrade to 16 (no problem), then to 17 (same error).

We found that we could manually delete the umbracoOpenIddict* tables and running through the upgrade would recreate them, but that feels dirty.

Anyone come across this?

Hi @chrisbdnz

Welcome to the forum!

Can you try upgrading to the latest version of v15 (15.4.4) before you migrate to v17? You may also need to upgrade to v16 as an interim step, so worth giving that a try as well.

Justin

Hi @justin-nevitech,

We tried that, same result.

We’ve also tried to first upgrade to 16 (no problem), then to 17 (same error).

We’ve upgraded another site from 13 to 17 directly, no problem.

Hi @chrisbdnz

There was a fix in 17.4 which should resolve issue migrating (EF Core Migrations run as "fire and forget" tasks, their success status is saved before they successfully complete · Issue #22200 · umbraco/Umbraco-CMS · GitHub), but you are trying 17.4.2, so you should be ok. It could be that an earlier attempt to migrate through a previous version has left your database in an inconsistent state.

Have you tried doing a fresh migration from the latest v15 to v17?

If you are still having issue, then it may be worth raising an issue for HQ to investigate if you are able to supply a copy of your database for them to review?

Justin

Hi @justin-nevitech

Thanks for the reply.

Yeah, I did come across that fix, but like you said should already be included.

I will try to spin up a fresh U15 and compare the umbracoKeyValue table records. The one we’re trying to upgrade likely is a copy of one that started out from 14 or even earlier.

Chris

I have gotten to the bottom of this - we were missing the table __EFMigrationsHistory, so the upgrade was creating it and trying to apply all migrations.

I think we may have incorrectly deleted the table when we moved our own custom tables for this application to a separate database.

Creating the table and populating it with the expected 3 rows allows the upgrade to run through successfully.

1 Like