Index: branches/5.2.x/core/install.php =================================================================== diff -u -N -r16796 -r16797 --- branches/5.2.x/core/install.php (.../install.php) (revision 16796) +++ branches/5.2.x/core/install.php (.../install.php) (revision 16797) @@ -1,6 +1,6 @@ Conn->Query('RENAME TABLE ' . TABLE_PREFIX . 'SessionData TO ' . TABLE_PREFIX . 'UserSessionData'); } + $sessions_table_structure = $this->Conn->Query('DESCRIBE ' . TABLE_PREFIX . 'UserSessions', 'Field'); + + if ( !array_key_exists('SessionId', $sessions_table_structure) ) { + // Update to 5.2.2-B3 -> add missing columns before creating sessions. + $this->Conn->Query('ALTER TABLE ' . TABLE_PREFIX . 'UserSessions DROP INDEX `PRIMARY`'); + $this->Conn->Query( + 'ALTER TABLE ' . TABLE_PREFIX . 'UserSessions + ADD `SessionId` int NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST' + ); + $this->Conn->Query( + 'ALTER TABLE ' . TABLE_PREFIX . 'UserSessions + CHANGE `SessionKey` `SessionKey` char(64) NOT NULL DEFAULT ""' + ); + $this->Conn->Query( + 'ALTER TABLE ' . TABLE_PREFIX . 'UserSessions + ADD UNIQUE INDEX `SessionKey` (`SessionKey`) USING BTREE' + ); + $this->Conn->Query( + 'ALTER TABLE ' . TABLE_PREFIX . 'UserSessionData + CHANGE `SessionKey` `SessionId` int unsigned NOT NULL DEFAULT "0"' + ); + } + $next_preset = $this->Application->GetVar('next_preset'); if ($next_preset !== false) { /** @var UserHelper $user_helper */