diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs index caae677b9e..e04d36a395 100644 --- a/OpenSim/Data/MySQL/MySQLUserData.cs +++ b/OpenSim/Data/MySQL/MySQLUserData.cs @@ -121,131 +121,11 @@ namespace OpenSim.Data.MySQL Assembly assem = GetType().Assembly; Migration m = new Migration(database.Connection, assem, "UserStore"); - // TODO: After rev 6000, remove this. People should have - // been rolled onto the new migration code by then. - TestTables(m); - m.Update(); } public override void Dispose () { } - - #region Test and initialization code - - /// - /// Ensure that the user related tables exists and are at the latest version - /// - private void TestTables(Migration m) - { - Dictionary tableList = new Dictionary(); - - tableList[m_agentsTableName] = null; - tableList[m_usersTableName] = null; - tableList[m_userFriendsTableName] = null; - tableList[m_appearanceTableName] = null; - database.GetTableVersion(tableList); - - // if we've already started using migrations, get out of - // here, we've got this under control - if (m.Version > 0) - return; - - // if there are no tables, get out of here and let - // migrations do their job - if ( - tableList[m_agentsTableName] == null && - tableList[m_usersTableName] == null && - tableList[m_userFriendsTableName] == null && - tableList[m_appearanceTableName] == null - ) - return; - - // otherwise, let the upgrade on legacy proceed... - UpgradeAgentsTable(tableList[m_agentsTableName]); - UpgradeUsersTable(tableList[m_usersTableName]); - UpgradeFriendsTable(tableList[m_userFriendsTableName]); - UpgradeAppearanceTable(tableList[m_appearanceTableName]); - - // ... and set the version - if (m.Version == 0) - m.Version = 1; - } - - /// - /// Create or upgrade the table if necessary - /// - /// A null indicates that the table does not - /// currently exist - private void UpgradeAgentsTable(string oldVersion) - { - // null as the version, indicates that the table didn't exist - if (oldVersion == null) - { - database.ExecuteResourceSql("CreateAgentsTable.sql"); - return; - } - } - - /// - /// Create or upgrade the table if necessary - /// - /// A null indicates that the table does not - /// currently exist - private void UpgradeUsersTable(string oldVersion) - { - // null as the version, indicates that the table didn't exist - if (oldVersion == null) - { - database.ExecuteResourceSql("CreateUsersTable.sql"); - return; - } - else if (oldVersion.Contains("Rev. 1")) - { - database.ExecuteResourceSql("UpgradeUsersTableToVersion2.sql"); - return; - } - //m_log.Info("[DB]: DBVers:" + oldVersion); - } - - /// - /// Create or upgrade the table if necessary - /// - /// A null indicates that the table does not - /// currently exist - private void UpgradeFriendsTable(string oldVersion) - { - // null as the version, indicates that the table didn't exist - if (oldVersion == null) - { - database.ExecuteResourceSql("CreateUserFriendsTable.sql"); - return; - } - } - - /// - /// Create or upgrade the table if necessary - /// - /// A null indicates that the table does not - /// currently exist - private void UpgradeAppearanceTable(string oldVersion) - { - // null as the version, indicates that the table didn't exist - if (oldVersion == null) - { - database.ExecuteResourceSql("CreateAvatarAppearance.sql"); - return; - } - else if (oldVersion.Contains("Rev.1")) - { - database.ExecuteSql("drop table avatarappearance"); - database.ExecuteResourceSql("CreateAvatarAppearance.sql"); - return; - } - } - - #endregion - // see IUserDataPlugin override public UserProfileData GetUserByName(string user, string last) {