remove legacy pre-Migration database upgrade routines
parent
49df787665
commit
5bf5e1c320
|
@ -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
|
||||
|
||||
/// <summary>
|
||||
/// Ensure that the user related tables exists and are at the latest version
|
||||
/// </summary>
|
||||
private void TestTables(Migration m)
|
||||
{
|
||||
Dictionary<string, string> tableList = new Dictionary<string, string>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create or upgrade the table if necessary
|
||||
/// </summary>
|
||||
/// <param name="oldVersion">A null indicates that the table does not
|
||||
/// currently exist</param>
|
||||
private void UpgradeAgentsTable(string oldVersion)
|
||||
{
|
||||
// null as the version, indicates that the table didn't exist
|
||||
if (oldVersion == null)
|
||||
{
|
||||
database.ExecuteResourceSql("CreateAgentsTable.sql");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create or upgrade the table if necessary
|
||||
/// </summary>
|
||||
/// <param name="oldVersion">A null indicates that the table does not
|
||||
/// currently exist</param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create or upgrade the table if necessary
|
||||
/// </summary>
|
||||
/// <param name="oldVersion">A null indicates that the table does not
|
||||
/// currently exist</param>
|
||||
private void UpgradeFriendsTable(string oldVersion)
|
||||
{
|
||||
// null as the version, indicates that the table didn't exist
|
||||
if (oldVersion == null)
|
||||
{
|
||||
database.ExecuteResourceSql("CreateUserFriendsTable.sql");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create or upgrade the table if necessary
|
||||
/// </summary>
|
||||
/// <param name="oldVersion">A null indicates that the table does not
|
||||
/// currently exist</param>
|
||||
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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue