I just upgraded 9.1 to 9.1.1 on my local development server and the upgrade completely failed. I've tried rolling back to 9.1 but that now fails too with the same error.
Anyone any ideas how to fix this?
Logs:
{"@t":"2021-11-24T08:00:07.3099153Z","@mt":"SQL [{ContextIndex}]: {Sql}","ContextIndex":2,"Sql":"ALTER TABLE [umbracoContentVersionCleanupPolicy] ADD CONSTRAINT [FK_umbracoContentVersionCleanupPolicy_cmsContentType_nodeId] FOREIGN KEY ([contentTypeId]) REFERENCES [cmsContentType] ([nodeId]) ON DELETE CASCADE","SourceContext":"Umbraco.Cms.Infrastructure.Migrations.MigrationContext","ActionId":"b3c472fa-d3a8-46d5-9b4a-f1f962913621","ActionName":"Umbraco.Cms.Web.BackOffice.Install.InstallApiController.PostPerformInstall (Umbraco.Web.BackOffice)","RequestId":"8000001a-0005-fe00-b63f-84710c7967bb","RequestPath":"/install/api/PostPerformInstall","ProcessId":4428,"ProcessName":"w3wp","ThreadId":32,"AppDomainId":1,"AppDomainAppId":"e3cd97ca384bbdc7162b386e0de21594755c5c7a","MachineName":"WINDOWS-LNECG8A","Log4NetLevel":"INFO ","HttpRequestId":"2447af1f-8423-4b46-a739-42e67bb28587","HttpRequestNumber":6,"HttpSessionId":"7f7db3da-b7e0-dc9e-3b1c-2defa67d26e6"}
{"@t":"2021-11-24T08:00:07.3337916Z","@mt":"Exception ({InstanceId}).","@l":"Error","@x":"System.Data.SqlClient.SqlException (0x80131904): There are no primary or candidate keys in the referenced table 'cmsContentType' that match the referencing column list in the foreign key 'FK_umbracoContentVersionCleanupPolicy_cmsContentType_nodeId'.\r\nCould not create constraint or index. See previous errors.\r\n at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)\r\n at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)\r\n at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)\r\n at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)\r\n at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)\r\n at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite, String methodName)\r\n at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()\r\n at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteNonQuery() in C:\\projects\\dotnet\\src\\MiniProfiler.Shared\\Data\\ProfiledDbCommand.cs:line 281\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.FaultHandlingDbCommand.<ExecuteNonQuery>b__31_0()\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.FaultHandlingDbCommand.<>c__DisplayClass33_0`1.<Execute>b__0()\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.FaultHandlingDbCommand.Execute[T](Func`1 f)\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.FaultHandlingDbCommand.ExecuteNonQuery()\r\n at NPoco.Database.ExecuteNonQueryHelper(DbCommand cmd)\r\n at NPoco.Database.Execute(String sql, CommandType commandType, Object[] args)\r\nClientConnectionId:f5851158-b606-42ed-803a-03e3da3a65a3\r\nError Number:1776,State:0,Class:16","InstanceId":"baf313b3","SourceContext":"Umbraco.Cms.Infrastructure.Persistence.UmbracoDatabase","ActionId":"b3c472fa-d3a8-46d5-9b4a-f1f962913621","ActionName":"Umbraco.Cms.Web.BackOffice.Install.InstallApiController.PostPerformInstall (Umbraco.Web.BackOffice)","RequestId":"8000001a-0005-fe00-b63f-84710c7967bb","RequestPath":"/install/api/PostPerformInstall","ProcessId":4428,"ProcessName":"w3wp","ThreadId":32,"AppDomainId":1,"AppDomainAppId":"e3cd97ca384bbdc7162b386e0de21594755c5c7a","MachineName":"WINDOWS-LNECG8A","Log4NetLevel":"ERROR","HttpRequestId":"2447af1f-8423-4b46-a739-42e67bb28587","HttpRequestNumber":6,"HttpSessionId":"7f7db3da-b7e0-dc9e-3b1c-2defa67d26e6"}
{"@t":"2021-11-24T08:00:07.3443432Z","@mt":"Database configuration failed","@l":"Error","@x":"System.Data.SqlClient.SqlException (0x80131904): There are no primary or candidate keys in the referenced table 'cmsContentType' that match the referencing column list in the foreign key 'FK_umbracoContentVersionCleanupPolicy_cmsContentType_nodeId'.\r\nCould not create constraint or index. See previous errors.\r\n at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)\r\n at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)\r\n at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)\r\n at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)\r\n at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)\r\n at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite, String methodName)\r\n at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()\r\n at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteNonQuery() in C:\\projects\\dotnet\\src\\MiniProfiler.Shared\\Data\\ProfiledDbCommand.cs:line 281\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.FaultHandlingDbCommand.<ExecuteNonQuery>b__31_0()\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.FaultHandlingDbCommand.<>c__DisplayClass33_0`1.<Execute>b__0()\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.FaultHandlingDbCommand.Execute[T](Func`1 f)\r\n at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.FaultHandlingDbCommand.ExecuteNonQuery()\r\n at NPoco.Database.ExecuteNonQueryHelper(DbCommand cmd)\r\n at NPoco.Database.Execute(String sql, CommandType commandType, Object[] args)\r\n at NPoco.Database.Execute(Sql Sql)\r\n at NPoco.Database.Execute(String sql, Object[] args)\r\n at Umbraco.Cms.Infrastructure.Migrations.MigrationExpressionBase.ExecuteStatement(StringBuilder stmtBuilder)\r\n at Umbraco.Cms.Infrastructure.Migrations.MigrationExpressionBase.Execute()\r\n at Umbraco.Cms.Infrastructure.Migrations.Expressions.Create.Table.CreateTableOfDtoBuilder.ExecuteSql(String sql)\r\n at Umbraco.Cms.Infrastructure.Migrations.Expressions.Create.Table.CreateTableOfDtoBuilder.Do()\r\n at Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_9_1_0.AddContentVersionCleanupFeature.Migrate()\r\n at Umbraco.Cms.Infrastructure.Migrations.MigrationBase.Run()\r\n at Umbraco.Cms.Infrastructure.Migrations.MigrationPlanExecutor.Execute(MigrationPlan plan, String fromState)\r\n at Umbraco.Cms.Infrastructure.Migrations.Upgrade.Upgrader.Execute(IMigrationPlanExecutor migrationPlanExecutor, IScopeProvider scopeProvider, IKeyValueService keyValueService)\r\n at Umbraco.Cms.Infrastructure.Migrations.Install.DatabaseBuilder.UpgradeSchemaAndData(UmbracoPlan plan)\r\nClientConnectionId:f5851158-b606-42ed-803a-03e3da3a65a3\r\nError Number:1776,State:0,Class:16","SourceContext":"Umbraco.Cms.Infrastructure.Migrations.Install.DatabaseBuilder","ActionId":"b3c472fa-d3a8-46d5-9b4a-f1f962913621","ActionName":"Umbraco.Cms.Web.BackOffice.Install.InstallApiController.PostPerformInstall (Umbraco.Web.BackOffice)","RequestId":"8000001a-0005-fe00-b63f-84710c7967bb","RequestPath":"/install/api/PostPerformInstall","ProcessId":4428,"ProcessName":"w3wp","ThreadId":32,"AppDomainId":1,"AppDomainAppId":"e3cd97ca384bbdc7162b386e0de21594755c5c7a","MachineName":"WINDOWS-LNECG8A","Log4NetLevel":"ERROR","HttpRequestId":"2447af1f-8423-4b46-a739-42e67bb28587","HttpRequestNumber":6,"HttpSessionId":"7f7db3da-b7e0-dc9e-3b1c-2defa67d26e6"}
{"@t":"2021-11-24T08:00:07.3457724Z","@mt":"The database schema validation produced the following summary: {DbSchemaSummary}","DbSchemaSummary":"The following tables were found in the database, but are not in the current schema:\r\nuSyncSnapshotLog,vx_shop_basket,vx_shop_basket_discountcodes,vx_shop_basket_items,vx_shop_orders_metadata,vx_shop_orders,vx_shop_orders_log,SkybrudRedirects,UFDataSource,UFFolders,UFForms,UFPrevalueSource,UFRecordDataBit,UFRecordDataDateTime,UFRecordDataInteger,UFRecordDataLongString,UFRecordDataString,UFRecordFields,UFRecords,UFUserFormSecurity,UFUserSecurity,UFWorkflows,umbracoContentVersionCleanupPolicy\r\n \r\nThe following columns were found in the database, but are not in the current schema:\r\nuSyncSnapshotLog,Id,uSyncSnapshotLog,Key,uSyncSnapshotLog,Name,uSyncSnapshotLog,Applied,uSyncSnapshotLog,IsLocal,vx_shop_basket,Id,vx_shop_basket,Key,vx_shop_basket,CreateDT,vx_shop_basket,UpdateDT,vx_shop_basket,IPAddress,vx_shop_basket_discountcodes,BasketId,vx_shop_basket_discountcodes,PromotionId,vx_shop_basket_discountcodes,Code,vx_shop_basket_items,Id,vx_shop_basket_items,Key,vx_shop_basket_items,BasketId,vx_shop_basket_items,ProductId,vx_shop_basket_items,VariantId,vx_shop_basket_items,Quantity,vx_shop_basket_items,CreateDT,vx_shop_basket_items,UpdateDT,vx_shop_orders_metadata,MetaId,vx_shop_orders_metadata,OrderId,vx_shop_orders_metadata,Name,vx_shop_orders_metadata,Value,vx_shop_orders,OrderId,vx_shop_orders,OrderGuid,vx_shop_orders,ShopId,vx_shop_orders,UserId,vx_shop_orders,CreateDT,vx_shop_orders,UpdateDT,vx_shop_orders,FinalizedDT,vx_shop_orders,Status,vx_shop_orders,billing_email,vx_shop_orders,billing_firstname,vx_shop_orders,billing_lastname,vx_shop_orders,billing_organisation,vx_shop_orders,billing_jobtitle,vx_shop_orders,billing_address_1,vx_shop_orders,billing_address_2,vx_shop_orders,billing_city,vx_shop_orders,billing_state,vx_shop_orders,billing_country,vx_shop_orders,billing_postalcode,vx_shop_orders,billing_tel,vx_shop_orders,delivery_email,vx_shop_orders,delivery_firstname,vx_shop_orders,delivery_lastname,vx_shop_orders,delivery_address_1,vx_shop_orders,delivery_address_2,vx_shop_orders,delivery_city,vx_shop_orders,delivery_state,vx_shop_orders,delivery_country,vx_shop_orders,delivery_organisation,vx_shop_orders,delivery_jobtitle,vx_shop_orders,delivery_postalcode,vx_shop_orders,delivery_tel,vx_shop_orders,Total,vx_shop_orders,Net,vx_shop_orders,Vat,vx_shop_orders,Discount,vx_shop_orders,DiscountCode,vx_shop_orders_log,LogId,vx_shop_orders_log,OrderId,vx_shop_orders_log,CreateDT,vx_shop_orders_log,Log,SkybrudRedirects,Id,SkybrudRedirects,Key,SkybrudRedirects,RootId,SkybrudRedirects,RootKey,SkybrudRedirects,Url,SkybrudRedirects,QueryString,SkybrudRedirects,DestinationType,SkybrudRedirects,DestinationId,SkybrudRedirects,DestinationKey,SkybrudRedirects,DestinationUrl,SkybrudRedirects,Created,SkybrudRedirects,Updated,SkybrudRedirects,IsPermanent,SkybrudRedirects,IsRegex,SkybrudRedirects,ForwardQueryString,UFDataSource,Id,UFDataSource,Key,UFDataSource,Name,UFDataSource,Definition,UFDataSource,Created,UFDataSource,Updated,UFFolders,ParentKey,UFFolders,Id,UFFolders,Key,UFFolders,Name,UFFolders,Definition,UFFolders,Created,UFFolders,Updated,UFForms,Id,UFForms,Key,UFForms,Name,UFForms,Definition,UFForms,Created,UFForms,Updated,UFForms,FolderKey,UFPrevalueSource,Id,UFPrevalueSource,Key,UFPrevalueSource,Name,UFPrevalueSource,Definition,UFPrevalueSource,Created,UFPrevalueSource,Updated,UFRecordDataBit,Id,UFRecordDataBit,Key,UFRecordDataBit,Value,UFRecordDataDateTime,Id,UFRecordDataDateTime,Key,UFRecordDataDateTime,Value,UFRecordDataInteger,Id,UFRecordDataInteger,Key,UFRecordDataInteger,Value,UFRecordDataLongString,Id,UFRecordDataLongString,Key,UFRecordDataLongString,Value,UFRecordDataString,Id,UFRecordDataString,Key,UFRecordDataString,Value,UFRecordFields,Key,UFRecordFields,FieldId,UFRecordFields,Record,UFRecordFields,Alias,UFRecordFields,DataType,UFRecords,Id,UFRecords,Form,UFRecords,Created,UFRecords,Updated,UFRecords,CurrentPage,UFRecords,UmbracoPageId,UFRecords,IP,UFRecords,MemberKey,UFRecords,UniqueId,UFRecords,State,UFRecords,RecordData,UFUserFormSecurity,Id,UFUserFormSecurity,User,UFUserFormSecurity,Form,UFUserFormSecurity,HasAccess,UFUserFormSecurity,AllowInEditor,UFUserFormSecurity,SecurityType,UFUserSecurity,User,UFUserSecurity,ManageDataSources,UFUserSecurity,ManagePreValueSources,UFUserSecurity,ManageWorkflows,UFUserSecurity,ManageForms,UFWorkflows,FormId,UFWorkflows,Id,UFWorkflows,Key,UFWorkflows,Name,UFWorkflows,Definition,UFWorkflows,Created,UFWorkflows,Updated,umbracoContentVersion,preventCleanup,umbracoContentVersionCleanupPolicy,contentTypeId,umbracoContentVersionCleanupPolicy,preventCleanup,umbracoContentVersionCleanupPolicy,keepAllVersionsNewerThanDays,umbracoContentVersionCleanupPolicy,keepLatestVersionPerDayForDays,umbracoContentVersionCleanupPolicy,updated\r\n \r\nThe following constraints (Primary Keys, Foreign Keys and Indexes) were found in the database, but are not in the current schema:\r\nFK_UFFolders_UFFolders_ParentKey,FK_UFForms_UFFolders_FolderKey,FK_UFRecordDataBit_UFRecordFields_Key,FK_UFRecordDataDateTime_UFRecordFields_Key,FK_UFRecordDataInteger_UFRecordFields_Key,FK_UFRecordDataLongString_UFRecordFields_Key,FK_UFRecordDataString_UFRecordFields_Key,FK_UFRecordFields_UFRecords_Record,FK_umbracoContent_cmsContentType_NodeId,FK_cmsDocumentType_cmsContentType_nodeId,FK_cmsDocumentType_cmsTemplate_nodeId,FK_cmsDictionary_cmsDictionary_id,FK_cmsLanguageText_cmsDictionary_id,FK_cmsMemberType_cmsContentType_nodeId,FK_cmsPropertyTypeGroup_cmsContentType_nodeId,FK_cmsPropertyType_cmsContentType_nodeId,FK_cmsContentTypeAllowedContentType_cmsContentType,FK_cmsContentTypeAllowedContentType_cmsContentType1,FK_umbracoRedirectUrl_umbracoNode_uniqueID,FK_umbracoDocumentVersion_cmsTemplate_nodeId,FK_umbracoContentVersionCleanupPolicy_cmsContentType_nodeId,PK_SkybrudRedirects,PK_UFDataSource,PK_UFFolders,PK_UFForms,PK_UFPrevalueSource,PK_UFRecordDataBit,PK_UFRecordDataDateTime,PK_UFRecordDataInteger,PK_UFRecordDataLongString,PK_UFRecordDataString,PK_UFRecordFields,PK_UFRecords,PK_UFUserFormSecurity,PK_UFUserSecurity,PK_UFWorkflows,PK_uSyncSnapshotLog,PK_vx_shop_basket,PK_vx_shop_basket_discountcodes_1,PK_vx_shop_basket_items,PK_vx_shop_orders,PK_vx_shop_orders_log,PK_vx_shop_orders_metadata\r\n \r\nThe following indexes were found in the database, but are not in the current schema:\r\nUK_UFDataSource_Key,IX_UFFolders_ParentKey,UK_UFFolders_Key,IX_UFForms_FolderKey,UK_UFForms_Key,UK_UFPrevalueSource_Key,UK_UFUserFormSecurity_User_Form,IX_UFWorkflows_FormId,UK_UFWorkflows_Key,IX_umbracoUser_userLogin,IX_umbracoNode_UniqueId,IX_umbracoNode_ParentId,IX_umbracoNode_Level,IX_umbracoNode_Path,IX_umbracoNode_Trashed,IX_umbracoNode_ObjectType,IX_cmsContentType,IX_cmsContentType_icon,IX_cmsTemplate_nodeId,IX_umbracoContentVersion_NodeId,IX_umbracoContentVersion_Current,IX_umbracoMediaVersion,IX_umbracoDocument_Published,IX_cmsDictionary_id,IX_cmsDictionary_Parent,IX_umbracoLanguage_languageISOCode,IX_umbracoLanguage_fallbackLanguageId,IX_umbracoLog,IX_cmsMacro_UniqueId,IX_cmsMacroPropertyAlias,IX_cmsMacroProperty_UniquePropertyId,IX_cmsMacroProperty_Alias,IX_cmsMember_LoginName,IX_cmsPropertyTypeGroupUniqueID,IX_cmsPropertyTypeAlias,IX_cmsPropertyTypeUniqueID,IX_umbracoPropertyData_VersionId,IX_umbracoPropertyData_PropertyTypeId,IX_umbracoPropertyData_LanguageId,IX_umbracoPropertyData_Segment,IX_umbracoRelationType_UniqueId,IX_umbracoRelationType_name,IX_umbracoRelationType_alias,IX_umbracoRelation_parentChildType,IX_cmsTags_LanguageId,IX_cmsTags,IX_computerName,IX_umbracoServer_isActive,IX_umbracoAccess_nodeId,IX_umbracoAccessRule,IX_umbracoExternalLogin_userId,IX_umbracoRedirectUrl,IX_umbracoUserGroup_userGroupAlias,IX_umbracoUserGroup_userGroupName,IX_umbracoUser2NodePermission_nodeId,IX_umbracoUserStartNode_startNodeType,IX_umbracoUserLogin_lastValidatedUtc,IX_umbracoContentVersionCultureVariation_VersionId,IX_umbracoContentVersionCultureVariation_LanguageId,IX_umbracoDocumentCultureVariation_NodeId,IX_umbracoDocumentCultureVariation_LanguageId\r\n \r\nThe following unknown constraints (Primary Keys, Foreign Keys and Indexes) were found in the database, but are not in the current schema:\r\nUK_UFDataSource_Key,UK_UFFolders_Key,UK_UFForms_Key,UK_UFPrevalueSource_Key,UK_UFUserFormSecurity_User_Form,UK_UFWorkflows_Key\r\n \r\n","SourceContext":"Umbraco.Cms.Infrastructure.Migrations.Install.DatabaseBuilder","ActionId":"b3c472fa-d3a8-46d5-9b4a-f1f962913621","ActionName":"Umbraco.Cms.Web.BackOffice.Install.InstallApiController.PostPerformInstall (Umbraco.Web.BackOffice)","RequestId":"8000001a-0005-fe00-b63f-84710c7967bb","RequestPath":"/install/api/PostPerformInstall","ProcessId":4428,"ProcessName":"w3wp","ThreadId":32,"AppDomainId":1,"AppDomainAppId":"e3cd97ca384bbdc7162b386e0de21594755c5c7a","MachineName":"WINDOWS-LNECG8A","Log4NetLevel":"INFO ","HttpRequestId":"2447af1f-8423-4b46-a739-42e67bb28587","HttpRequestNumber":6,"HttpSessionId":"7f7db3da-b7e0-dc9e-3b1c-2defa67d26e6"}
{"@t":"2021-11-24T08:00:07.3463748Z","@mt":"Installation step {Step} failed.","@l":"Error","@x":"System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.\r\n ---> Umbraco.Cms.Core.Install.InstallException: 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 'cmsContentType' that match the referencing column list in the foreign key 'FK_umbracoContentVersionCleanupPolicy_cmsContentType_nodeId'.\r\nCould not create constraint or index. See previous errors.\n Please check log file for additional information (can be found in '~/umbraco/Logs')\r\n at Umbraco.Cms.Infrastructure.Install.InstallSteps.DatabaseUpgradeStep.ExecuteAsync(Object model)\r\n --- End of inner exception stack trace ---\r\n at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)\r\n at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)\r\n at Umbraco.Cms.Web.BackOffice.Install.InstallApiController.ExecuteStepAsync(InstallSetupStep step, Object instruction)\r\n at Umbraco.Cms.Web.BackOffice.Install.InstallApiController.PostPerformInstall(InstallInstructions installModel)","Step":"DatabaseUpgrade","SourceContext":"Umbraco.Cms.Web.BackOffice.Install.InstallApiController","ActionId":"b3c472fa-d3a8-46d5-9b4a-f1f962913621","ActionName":"Umbraco.Cms.Web.BackOffice.Install.InstallApiController.PostPerformInstall (Umbraco.Web.BackOffice)","RequestId":"8000001a-0005-fe00-b63f-84710c7967bb","RequestPath":"/install/api/PostPerformInstall","ProcessId":4428,"ProcessName":"w3wp","ThreadId":32,"AppDomainId":1,"AppDomainAppId":"e3cd97ca384bbdc7162b386e0de21594755c5c7a","MachineName":"WINDOWS-LNECG8A","Log4NetLevel":"ERROR","HttpRequestId":"2447af1f-8423-4b46-a739-42e67bb28587","HttpRequestNumber":6,"HttpSessionId":"7f7db3da-b7e0-dc9e-3b1c-2defa67d26e6"}
{"@t":"2021-11-24T08:00:07.3464271Z","@mt":"{EndMessage} ({Duration}ms) [Timing {TimingId}]","EndMessage":"Step completed","Duration":138,"TimingId":"6e435c2","SourceContext":"Umbraco.Cms.Core.Logging.ProfilingLogger","ActionId":"b3c472fa-d3a8-46d5-9b4a-f1f962913621","ActionName":"Umbraco.Cms.Web.BackOffice.Install.InstallApiController.PostPerformInstall (Umbraco.Web.BackOffice)","RequestId":"8000001a-0005-fe00-b63f-84710c7967bb","RequestPath":"/install/api/PostPerformInstall","ProcessId":4428,"ProcessName":"w3wp","ThreadId":32,"AppDomainId":1,"AppDomainAppId":"e3cd97ca384bbdc7162b386e0de21594755c5c7a","MachineName":"WINDOWS-LNECG8A","Log4NetLevel":"INFO ","HttpRequestId":"2447af1f-8423-4b46-a739-42e67bb28587","HttpRequestNumber":6,"HttpSessionId":"7f7db3da-b7e0-dc9e-3b1c-2defa67d26e6"}
{"@t":"2021-11-24T08:00:07.3465093Z","@mt":"An error occurred during installation step {Step}","@l":"Error","@x":"System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.\r\n ---> Umbraco.Cms.Core.Install.InstallException: 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 'cmsContentType' that match the referencing column list in the foreign key 'FK_umbracoContentVersionCleanupPolicy_cmsContentType_nodeId'.\r\nCould not create constraint or index. See previous errors.\n Please check log file for additional information (can be found in '~/umbraco/Logs')\r\n at Umbraco.Cms.Infrastructure.Install.InstallSteps.DatabaseUpgradeStep.ExecuteAsync(Object model)\r\n --- End of inner exception stack trace ---\r\n at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)\r\n at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)\r\n at Umbraco.Cms.Web.BackOffice.Install.InstallApiController.ExecuteStepAsync(InstallSetupStep step, Object instruction)\r\n at Umbraco.Cms.Web.BackOffice.Install.InstallApiController.PostPerformInstall(InstallInstructions installModel)","Step":"DatabaseUpgrade","SourceContext":"Umbraco.Cms.Web.BackOffice.Install.InstallApiController","ActionId":"b3c472fa-d3a8-46d5-9b4a-f1f962913621","ActionName":"Umbraco.Cms.Web.BackOffice.Install.InstallApiController.PostPerformInstall (Umbraco.Web.BackOffice)","RequestId":"8000001a-0005-fe00-b63f-84710c7967bb","RequestPath":"/install/api/PostPerformInstall","ProcessId":4428,"ProcessName":"w3wp","ThreadId":32,"AppDomainId":1,"AppDomainAppId":"e3cd97ca384bbdc7162b386e0de21594755c5c7a","MachineName":"WINDOWS-LNECG8A","Log4NetLevel":"ERROR","HttpRequestId":"2447af1f-8423-4b46-a739-42e67bb28587","HttpRequestNumber":6,"HttpSessionId":"7f7db3da-b7e0-dc9e-3b1c-2defa67d26e6"}
{"@t":"2021-11-24T08:02:53.1028967Z","@mt":"ContentVersionCleanup task will not run as it has been globally disabled via configuration","SourceContext":"Umbraco.Cms.Infrastructure.HostedServices.ContentVersionCleanup","ProcessId":4428,"ProcessName":"w3wp","ThreadId":80,"AppDomainId":1,"AppDomainAppId":"e3cd97ca384bbdc7162b386e0de21594755c5c7a","MachineName":"WINDOWS-LNECG8A","Log4NetLevel":"INFO "}
It looks like a migration or previous migration hasn't run, and so what the current upgrade is 'assuming' to be there, eg the foreign key [contentTypeId] on the table cmsContentType, isn't and the ALTER statement is failing because of it...
Did you go direct to 9.1.1?
In 9.1 the clean up version history functionality (and that new table was added) so I'm wondering if there is a migration in 9.1.1. that depends on you having upgraded to 9.1 first - or it may just be broken and you are first to test!
If you have a look in the umbracoKeyValue table it should tell you all the migrations that have successfully run, removing the entry from here would rerun them, so that might be why you are having problems now trying 9.1 as the migration is down as being run before? to try again check this table and remove any 9.1 migrations and try going to 9.1 first?
Otherwise pragmatically in this scenario, you could install a brand new version of 9.1.1 and have a look in SQL at what the missing foreign key is...
script it's creation
and run it on your existing database, then try the migration again...
if you are lucky that is the only thing stopping all the migrations to run successfully.
Thank you for the suggestions Marc. The problem was caused when I upgraded from 9.0.1 directly to 9.1.1. I've been unable to recover the VS project and had to create a new install of 9.0.1 which I then pointed at a backup of the original database before the catastrophic upgrade. I'm sure there are better solutions but I could not get anything else to work.
I then upgraded 9.0.1 to 9.1.0 and then to 9.1.1 which has worked.
The latest upgrade seems to be missing something as once upgraded to 9.1.0 the database changes required by the 9.1.1 upgrade were applied to the database. It completely fails when upgrading from 9.0.1 to 9.1.1 directly.
I have the same problem when upgrading from 10.0.0 to 10.6.1
"The database schema validation produced the following summary: {DbSchemaSummary}","DbSchemaSummary":"The following tables were found in the database, but are not in the current schema:\r\nSeoToolkitMetaFieldsSettings,MACustomers,SeoToolkitMetaFieldsValue,SeoToolkitRedirects,SeoToolkitRobotsTxt,SeoToolkitScript,SeoToolkitSeoSettings,SeoToolkitSiteAudit,SeoToolkitSiteAuditCheck,SeoToolkitSiteAuditCheckResult,SeoToolkitSiteAu....
upgrade from 9.1 to 9.1.1 failed
I just upgraded 9.1 to 9.1.1 on my local development server and the upgrade completely failed. I've tried rolling back to 9.1 but that now fails too with the same error.
Anyone any ideas how to fix this?
Logs:
HI AbsolutelyN
It looks like a migration or previous migration hasn't run, and so what the current upgrade is 'assuming' to be there, eg the foreign key [contentTypeId] on the table cmsContentType, isn't and the ALTER statement is failing because of it...
Did you go direct to 9.1.1?
In 9.1 the clean up version history functionality (and that new table was added) so I'm wondering if there is a migration in 9.1.1. that depends on you having upgraded to 9.1 first - or it may just be broken and you are first to test!
If you have a look in the umbracoKeyValue table it should tell you all the migrations that have successfully run, removing the entry from here would rerun them, so that might be why you are having problems now trying 9.1 as the migration is down as being run before? to try again check this table and remove any 9.1 migrations and try going to 9.1 first?
Otherwise pragmatically in this scenario, you could install a brand new version of 9.1.1 and have a look in SQL at what the missing foreign key is...
script it's creation
and run it on your existing database, then try the migration again...
if you are lucky that is the only thing stopping all the migrations to run successfully.
regards
marc
Thank you for the suggestions Marc. The problem was caused when I upgraded from 9.0.1 directly to 9.1.1. I've been unable to recover the VS project and had to create a new install of 9.0.1 which I then pointed at a backup of the original database before the catastrophic upgrade. I'm sure there are better solutions but I could not get anything else to work.
I then upgraded 9.0.1 to 9.1.0 and then to 9.1.1 which has worked.
The latest upgrade seems to be missing something as once upgraded to 9.1.0 the database changes required by the 9.1.1 upgrade were applied to the database. It completely fails when upgrading from 9.0.1 to 9.1.1 directly.
Many thanks
I have the same problem when upgrading from 10.0.0 to 10.6.1
is working on a reply...