U4-7267 - SQL Fail upgrading from 7.2.8 to 7.3 due to foreign key constraint on cmsTemplate master

Created by Jean-François Dessureault 16 Oct 2015, 19:28:56 Updated by emmorey99 08 Feb 2016, 00:00:15

When upgrading Umbraco 7.2.8 to 7.3.0, a SQL exception is thrown during the upgrade process:

Error message in the browser:

Error during installation

The database failed to upgrade. ERROR: The database configuration failed with the following message: The object 'FK__cmsTempla__maste__22751F6C' is dependent on column 'master'. ALTER TABLE DROP COLUMN master failed because one or more objects access this column. Please check log file for additional information (can be found in '/App_Data/Logs/UmbracoTraceLog.txt')

See the log for full details (logs can typically be found in the App_Data\Logs folder).

UmbracoTraceLog.txt:

The following indexes were found in the database, but are not in the current schema:
IX_umbracoUserLogins_Index,IX_cmsPropertyTypeUniqueID,IX_umbracoAccess_nodeId,IX_umbracoAccessRule,IX_umbracoMigration
 
 2015-10-16 15:12:56,459 [P19764/D4/T6] ERROR Umbraco.Web.Install.Controllers.InstallApiController - Installation step DatabaseUpgrade failed.
System.Reflection.TargetInvocationException: Une exception a été levée par la cible d'un appel. ---> Umbraco.Web.Install.InstallException: The database failed to upgrade. ERROR: The database configuration failed with the following message: The object 'FK__cmsTempla__maste__22751F6C' is dependent on column 'master'.
ALTER TABLE DROP COLUMN master failed because one or more objects access this column.
 Please check log file for additional information (can be found in '/App_Data/Logs/UmbracoTraceLog.txt')
   à Umbraco.Web.Install.InstallSteps.DatabaseUpgradeStep.Execute(Object model)
   --- Fin de la trace de la pile d'exception interne ---
   à System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   à System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   à System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   à System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   à Umbraco.Web.Install.Controllers.InstallApiController.ExecuteStep(InstallSetupStep step, JToken instruction)
 2015-10-16 15:12:56,518 [P19764/D4/T6] INFO  Umbraco.Web.Install.Controllers.InstallApiController - Step completed (took 552714ms)
 2015-10-16 15:12:56,518 [P19764/D4/T6] ERROR Umbraco.Web.Install.Controllers.InstallApiController - An error occurred during installation step DatabaseUpgrade
System.Reflection.TargetInvocationException: Une exception a été levée par la cible d'un appel. ---> Umbraco.Web.Install.InstallException: The database failed to upgrade. ERROR: The database configuration failed with the following message: The object 'FK__cmsTempla__maste__22751F6C' is dependent on column 'master'.
ALTER TABLE DROP COLUMN master failed because one or more objects access this column.
 Please check log file for additional information (can be found in '/App_Data/Logs/UmbracoTraceLog.txt')
   à Umbraco.Web.Install.InstallSteps.DatabaseUpgradeStep.Execute(Object model)
   --- Fin de la trace de la pile d'exception interne ---
   à System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   à System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   à System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   à System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   à Umbraco.Web.Install.Controllers.InstallApiController.ExecuteStep(InstallSetupStep step, JToken instruction)
   à Umbraco.Web.Install.Controllers.InstallApiController.PostPerformInstall(InstallInstructions installModel)

Comments

Jean-François Dessureault 03 Nov 2015, 18:58:00

This bug still prevents from upgrading to 7.3.1


Jean-François Dessureault 27 Jan 2016, 04:20:48

I was able to upgrade to 7.3.5 by dropping the foreign key causing the problem ({{FK__cmsTempla__maste__22751F6C}}). I compared my DB with a fresh install of 7.3.5, and it seems there is no column master on cmsTemplate anymore. Therefore, deleting it shouldn't cause any trouble.

I don't know if it's related, but my database was created with Umbraco 6 and was upgraded to 7 afterwards.

ALTER TABLE [dbo].[cmsTemplate] DROP CONSTRAINT [FK__cmsTempla__maste__22751F6C] GO


emmorey99 08 Feb 2016, 00:00:15

Thanks, for me the mid-install error when upgrading from 7.2.1 to 7.3.7 assembly: 1.0.5876.3092 was:

2016-02-07 23:29:41,094 [P7788/D3/T24] ERROR Umbraco.Web.Install.Controllers.InstallApiController - Installation step DatabaseUpgrade failed. 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: The object 'cmsTemplate_FK_cmsTemplate_cmsTemplate' is dependent on column 'master'. ALTER TABLE DROP COLUMN master failed because one or more objects access this column. Please check log file for additional information (can be found in '/App_Data/Logs/UmbracoTraceLog.txt') at Umbraco.Web.Install.InstallSteps.DatabaseUpgradeStep.Execute(Object model) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Umbraco.Web.Install.Controllers.InstallApiController.ExecuteStep(InstallSetupStep step, JToken instruction)

And the SQL fix was:

ALTER TABLE [dbo].[cmsTemplate] DROP CONSTRAINT [cmsTemplate_FK_cmsTemplate_cmsTemplate] GO


Priority: Normal

Type: Bug

State: Workaround posted

Assignee:

Difficulty: Normal

Category: Installation

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.2.8, 7.3.1, 7.3.2, 7.3.3, 7.3.4, 7.3.5

Due in version:

Sprint:

Story Points:

Cycle: