Umbraco upgrade 6.0.1 document type bug solution

In the umbraco 6.0.2 release blog post the team announced a very nasty bug that occurred in the v6.0.1 upgrade. I was getting this error when clicking a node and also this error when trying to edit the document type:

InvalidOperationException: Sequence contains more than one matching element

In the above post, by reading the comments of all frustrated and disappointed users, I found a solution to manually fix the messed up database.

As the post suggested, checking the cmsPropertyTypeGroup table helped already to identify the problem: tabs were duplicated. Before version 6.0.1 the parentGroupId was never used. The upgrade script in version 6.0.1 duplicated the tabs for the document types inheriting the tabs from a master document type, so for the child document type tabs, you could see the inherited tab with the relative parentGroupId. The problem is that for every property, a new tab was added. So a tab containing for example 6 properties would be added 6 times. To fix the problem, you have to set the 6 properties to the first occurrence of the new tab.

In example, in my case (after upgrading from 6.0.0 to 6.0.1 and from 6.0.1 to 6.0.2) I could see the Tab nr 52 repeated 6 times (you can see the same contenttypeNodeId and the same text in the doubles), from id 52 till id 57. The solution was to find all properties pointing to tabs from 52 to 57 and update their propertyTypeGroupId to 52. Here you can find my SQL script that helped me to fix them all.

BEGIN TRANSACTION

SELECT * FROM cmsPropertyType
WHERE propertyTypeGroupId > 51 AND propertyTypeGroupId < 58

UPDATE cmsPropertyType SET propertyTypeGroupId = 52
WHERE propertyTypeGroupId > 51 AND propertyTypeGroupId < 58

SELECT * FROM cmsPropertyType
WHERE propertyTypeGroupId = 52

ROLLBACK TRANSACTION


After updating the records, I was able to delete the duplicate tabs (53,54,55,56,57: only 5, the first one has to be kept).

What to do next: touch the web.config in order to reset all the cache. Login to umbraco, go to the document type and simply save it. Go to a node using the document type and see that it's working.

Enjoy.