Index: branches/5.2.x/core/install/upgrades.sql
===================================================================
diff -u -r14244 -r14437
--- branches/5.2.x/core/install/upgrades.sql	(.../upgrades.sql)	(revision 14244)
+++ branches/5.2.x/core/install/upgrades.sql	(.../upgrades.sql)	(revision 14437)
@@ -1993,4 +1993,23 @@
 	SET l<%PRIMARY_LANGUAGE%>_Translation = 'Use Cron to run Agents'
 	WHERE PhraseKey = 'LA_USECRONFORREGULAREVENT' AND l<%PRIMARY_LANGUAGE%>_Translation = 'Use Cron for Running Regular Events';
 
-# ===== v 5.1.1 =====
\ No newline at end of file
+# ===== v 5.1.1 =====
+
+# ===== v 5.2.0-B1 =====
+ALTER TABLE PortalUser
+	ADD UserType TINYINT NOT NULL,
+	ADD PrimaryGroupId INT NULL,
+	ADD INDEX (UserType);
+
+UPDATE PortalUser u
+SET u.PrimaryGroupId = (SELECT ug.GroupId FROM <%TABLE_PREFIX%>UserGroup ug WHERE ug.PortalUserId = u.PortalUserId AND ug.PrimaryGroup = 1);
+
+UPDATE PortalUser u SET u.UserType = IF(u.PrimaryGroupId = 11, 1, 0);
+
+ALTER TABLE UserGroup DROP PrimaryGroup;
+
+UPDATE ConfigurationValues
+SET DisplayOrder = DisplayOrder + 0.01
+WHERE `ModuleOwner` = 'In-Portal:Users' AND `Section` = 'in-portal:configure_users' AND DisplayOrder BETWEEN 10.12 AND 20.00;
+
+INSERT INTO ConfigurationValues VALUES(DEFAULT, 'User_AdminGroup', '11', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_users_admin_group', 'select', NULL, '0=lu_none||<SQL+>SELECT GroupId as OptionValue, Name as OptionName FROM <PREFIX>PortalGroup WHERE Enabled=1 AND Personal=0</SQL>', 10.12, 0, 1, NULL);
\ No newline at end of file
