umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.48k stars 2.69k forks source link

14.0.0-RC1 Throws error during upgrade #16115

Closed enkelmedia closed 6 months ago

enkelmedia commented 6 months ago

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

14.0.0-RC1

Bug summary

I'm upgrading a SQL Server database that was created on something like Umbraco 9 and then has been upgraded up to v14.0.0-beta1. When upgrading to RC1 the bootscreen throws.

Specifics

BootFailedException: Boot failed: Umbraco cannot run. See Umbraco's log file for more details.

-> Umbraco.Cms.Core.Exceptions.BootFailedException: An error occurred while running the unattended upgrade.
The database configuration failed with the following message: There are no primary or candidate keys in the referenced table 'umbracoUser' that match the referencing column list in the foreign key 'FK_umbracoUserData_umbracoUser_key'.
Could not create constraint or index. See previous errors.
Please check log file for additional information (can be found in 'LoggingSettings.Directory')

-> Umbraco.Cms.Core.Exceptions.UnattendedInstallException: An error occurred while running the unattended upgrade.
The database configuration failed with the following message: There are no primary or candidate keys in the referenced table 'umbracoUser' that match the referencing column list in the foreign key 'FK_umbracoUserData_umbracoUser_key'.
Could not create constraint or index. See previous errors.
Please check log file for additional information (can be found in 'LoggingSettings.Directory')
BootFailedException: Boot failed: Umbraco cannot run. See Umbraco's log file for more details. -> Umbraco.Cms.Core.Exceptions.BootFailedException: An error occurred while running the unattended upgrade. The database configuration failed with the following message: There are no primary or candidate keys in the referenced table 'umbracoUser' that match the referencing column list in the foreign key 'FK_umbracoUserData_umbracoUser_key'. Could not create constraint or index. See previous errors. Please check log file for additional information (can be found in 'LoggingSettings.Directory') -> Umbraco.Cms.Core.Exceptions.UnattendedInstallException: An error occurred while running the unattended upgrade. The database configuration failed with the following message: There are no primary or candidate keys in the referenced table 'umbracoUser' that match the referencing column list in the foreign key 'FK_umbracoUserData_umbracoUser_key'. Could not create constraint or index. See previous errors. Please check log file for additional information (can be found in 'LoggingSettings.Directory')
Umbraco.Cms.Core.Exceptions.BootFailedException.Rethrow(BootFailedException bootFailedException)
Umbraco.Cms.Web.Common.Middleware.BootFailedMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+InterfaceMiddlewareBinder+<>c__DisplayClass2_0+<<CreateMiddleware>b__0>d.MoveNext()
SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext httpContext, bool retry)
Umbraco.Cms.Api.Management.Middleware.BackOfficeAuthorizationInitializationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+InterfaceMiddlewareBinder+<>c__DisplayClass2_0+<<CreateMiddleware>b__0>d.MoveNext()
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

Steps to reproduce

Upgrade from v9 via v10, v11,v12, v13 and then to v14 rc1

Expected result / actual result

Upgrades should work or error should provide information about needed action.

github-actions[bot] commented 6 months ago

Hi there @enkelmedia!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:

enkelmedia commented 6 months ago

This will solve the problem if anyone else has the same issue:

ALTER TABLE [dbo].[umbracoUser] DROP CONSTRAINT DF_umbracoUser_key;
ALTER TABLE [dbo].[umbracoUser] ADD CONSTRAINT DF_umbracoUser_key UNIQUE ([key]);
Zeegaan commented 6 months ago

Heyo! 👋 This is a bug caused by a missing index, which has been fixed when going from v13 -> v14-rc1 Problem is if you were already on the beta001, there is not much we can do 🤔 (we cannot insert the migration earlier, as that breaks everyone already on rc1)

Atleast there is a manual workaround you have come up with for now 😁 But we will look into if there is a possible way of resolving this, thanks for reporting 🐛

enkelmedia commented 6 months ago

I figured that this was the problem =D I guess that is a very small issue, not many people that is upgrading from beta001 to rc1 =D

I'm okey with closing the issue, or keep it open for a while if anyone else have the same issue but might not need to be addresses in code.

Feel free to close if you want to =D