When trying to upgrade v8.9.1 to 8.18.12 it work fine on my local dev (Umbraco.sdf), but in production (MSSQL) I get this error during upgrade:
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: 'FK_umbracoRedirectUrl_umbracoNode_uniqueID' is not a constraint.\r\nCould not drop constraint. See previous errors.\n Please check log file for additional information (can be found in '/App_Data/Logs/')\r\n at Umbraco.Web.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)\r\n at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)\r\n at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n at Umbraco.Web.Install.Controllers.InstallApiController.<ExecuteStepAsync>d__14.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Umbraco.Web.Install.Controllers.InstallApiController.<PostPerformInstall>d__11.MoveNext()"
I have tried adding and removing constraints, but I just f... things more up.... :)
This query can give you list of constraints which are unique and relative to upgrade.
SELECT 'DROP INDEX [' + IX.NAME + '] ON ' + OBJECT_NAME(IX.OBJECT_ID) + '; '
FROM SYS.INDEXES IX
JOIN SYS.OBJECTS O ON IX.OBJECT_ID = O.OBJECT_ID
INNER JOIN SYS.SCHEMAS S ON O.SCHEMA_ID = S.SCHEMA_ID
WHERE
IX.NAME IS NOT NULL
AND O.TYPE <> 'S'
AND IS_PRIMARY_KEY <> 1
AND INDEX_ID > 0
AND S.NAME != 'SYS' AND S.NAME!= 'SYS' AND IS_UNIQUE_CONSTRAINT = 1
Also check on the App_Data/logs , what is the exact SQL query that upgrade is attempting.
once you get the query , you can map the values to below Query , this will generate you the alter sql statement for all the dependent constraints.
SELECT 'ALTER TABLE [' + object_name(f.parent_object_id) + '] DROP CONSTRAINT [' + f.name + ']; '
From
sys.foreign_keys f
inner join
sys.indexes i
on f.referenced_object_id = i.object_id and
f.key_index_id = i.index_id
Where
i.name = 'PK_user' and
i.object_id = object_id('[dbo].[umbracoUser]')
ALTER TABLE umbracoRedirectUrl WITH NOCHECK
ADD CONSTRAINT FK_umbracoRedirectUrl_umbracoNode_uniqueID CHECK (contentKey <> '') ;
ALTER TABLE umbracoNode
DROP CONSTRAINT IX_umbracoNode_UniqueId
Minor upgrade v.8: "'FK_umbracoRedirectUrl_umbracoNode_uniqueID' is not a constraint. Could not drop constraint."
Hi forum,
When trying to upgrade v8.9.1 to 8.18.12 it work fine on my local dev (Umbraco.sdf), but in production (MSSQL) I get this error during upgrade:
I have tried adding and removing constraints, but I just f... things more up.... :)
Can anyone help me?
This query can give you list of constraints which are unique and relative to upgrade.
Also check on the App_Data/logs , what is the exact SQL query that upgrade is attempting.
once you get the query , you can map the values to below Query , this will generate you the alter sql statement for all the dependent constraints.
There's a solution in this thread that may help? https://our.umbraco.com/forum/using-umbraco-and-getting-started/106748-cant-upgrade-from-umbraco-8141-to-8151
Thanks, it did indeed help :)
More precisely Sams solution: https://our.umbraco.com/forum/using-umbraco-and-getting-started/106748-cant-upgrade-from-umbraco-8141-to-8151#comment-333239 (which as also marked as solution):
is working on a reply...