15.1.2.4260 db upgrade issue

iMIS Version: 15.1.2.4260

If you run the upgrade process the second time (probably because something went wrong the first time you ran it), most likely, it will fail with the following error:

Violation of PRIMARY KEY constraint 'PK_ComponentRegistryCategory'. Cannot insert duplicate key in object 'dbo.ComponentRegistryCategory'.

The issue is with the following SQL statement in

C:\Program Files\ASI\iMIS15\Net\iMIS15DBUpgrade\ScriptFiles\IMIS154DBUpgrade\CleaningUpNavigationDocuments.sql.

at the following line:

IF NOT EXISTS (SELECT 1 FROM [dbo].[ComponentRegistryCategory] WHERE [ComponentKey] = '5CC7111C-44E4-402B-AC6E-619C253BF6F8')
BEGIN
INSERT INTO [dbo].[ComponentRegistryCategory] ([ComponentKey],[ComponentCategoryKey])
VALUES('199CAB08-7BB2-4840-8291-47B89B8BEDBD', '5CC7111C-44E4-402B-AC6E-619C253BF6F8')
END

the statement should be:

IF NOT EXISTS (SELECT 1 FROM [dbo].[ComponentRegistryCategory] WHERE [ComponentKey] = '199CAB08-7BB2-4840-8291-47B89B8BEDBD')
BEGIN
INSERT INTO [dbo].[ComponentRegistryCategory] ([ComponentKey],[ComponentCategoryKey])
VALUES('199CAB08-7BB2-4840-8291-47B89B8BEDBD', '5CC7111C-44E4-402B-AC6E-619C253BF6F8')
END

Nasser