The Database upgrade fails with the log file showing the following error: "Cannot insert duplicate key row in object 'dbo.UserLink' with unique index 'IX_UserLink_Active'."
Script.SaasAdministratorLG.sql encountered an error
An error occurred while the batch was being executed.
Updating database (Failed)
*** Could not deploy package.
Warning SQL72015: The column [dbo].[GettingStartedOverride].[ItemLink] is being dropped, data loss could occur.
Warning SQL72015: The type for column ModifiedBy in table [deviceApplication].[ApplicationProvisioningProfileHistory] is currently DATETIME NULL but is being changed to INT NULL. Data loss could occur.
Warning SQL72015: The column [mobileManagement].[DeviceEnrollmentStaging].[SessionToken] is being dropped, data loss could occur.
Error SQL72014: .Net SqlClient Data Provider: Msg 50000, Level 14, State 1, Line 80 Cannot insert duplicate key row in object 'dbo.UserLink' with unique index 'IX_UserLink_Active'. The duplicate key value is (52, 1).
Error SQL72045: Script execution error. The executed script:
PRINT 'Begin Post-Deployment Script...';
- This Error occurs when there is a duplicate entry in the dbo.userlink table in SQL for an admin.
- The line in the log "The duplicate key value is (52, 1)" refers to the admin account whose coreuserid = 52.
- In SQL find the UserlinkIDs associated CoreUserID = 52 using the following command: "select * from dbo.userlink where coreuserid = 52"
- In the Screenshot below the conflicting UserLinkID is 85 (notice it has the same roleID and LocationGroupID as UserlinkID = 88)
- NOTE: Ensure the roleID and LocationGroupID are the same in the conflicting records. If they are not you will delete part of the access level for one of your administrator users.
- If you find this scenario please contact our support team and reference this article for assistance in correcting this conflict.