Index: branches/5.1.x/core/install/upgrades.sql
===================================================================
diff -u -r13892 -r13951
--- branches/5.1.x/core/install/upgrades.sql	(.../upgrades.sql)	(revision 13892)
+++ branches/5.1.x/core/install/upgrades.sql	(.../upgrades.sql)	(revision 13951)
@@ -1944,3 +1944,11 @@
 UPDATE Phrase
 SET l<%PRIMARY_LANGUAGE%>_Translation = 'Comments'
 WHERE PhraseKey = 'LA_FLD_COMMENTS';
+
+ALTER TABLE Category
+	CHANGE `Type` `Type` INT(11) NOT NULL DEFAULT '1',
+	CHANGE `IsSystem` `Protected` TINYINT( 4 ) NOT NULL DEFAULT '0',
+	ADD INDEX ( `Protected` );
+
+UPDATE Category SET `Type` = IF(`Protected` = 1, 2, 1);
+UPDATE Category SET `Protected` = 1 WHERE ThemeId > 0;
\ No newline at end of file
