remove pre-Migration upgrade paths
parent
53afa23608
commit
ba16a27ab0
|
@ -90,101 +90,9 @@ namespace OpenSim.Data.MySQL
|
|||
// This actually does the roll forward assembly stuff
|
||||
Assembly assem = GetType().Assembly;
|
||||
Migration m = new Migration(database.Connection, assem, "InventoryStore");
|
||||
|
||||
// TODO: After rev 6000, remove this. People should have
|
||||
// been rolled onto the new migration code by then.
|
||||
TestTables(database.Connection, m);
|
||||
|
||||
m.Update();
|
||||
}
|
||||
|
||||
#region Test and initialization code
|
||||
|
||||
/// <summary>
|
||||
/// <list type="bullet">
|
||||
/// <item>Execute CreateFoldersTable.sql if oldVersion == null</item>
|
||||
/// <item>do nothing if oldVersion != null</item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
/// <param name="oldVersion"></param>
|
||||
private void UpgradeFoldersTable(string oldVersion)
|
||||
{
|
||||
// null as the version, indicates that the table didn't exist
|
||||
if (oldVersion == null)
|
||||
{
|
||||
database.ExecuteResourceSql("CreateFoldersTable.sql");
|
||||
return;
|
||||
}
|
||||
|
||||
//// if the table is already at the current version, then we can exit immediately
|
||||
// if (oldVersion == "Rev. 2")
|
||||
// return;
|
||||
// database.ExecuteResourceSql("UpgradeFoldersTableToVersion2.sql");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <list type="bullet">
|
||||
/// <item>Execute CreateItemsTable.sql if oldVersion == null</item>
|
||||
/// <item>Execute "UpgradeItemsTableToVersion3.sql" if oldVersion start with "Rev. 2;"</item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
/// <param name="oldVersion"></param>
|
||||
private void UpgradeItemsTable(string oldVersion)
|
||||
{
|
||||
// null as the version, indicates that the table didn't exist
|
||||
if (oldVersion == null)
|
||||
{
|
||||
database.ExecuteResourceSql("CreateItemsTable.sql");
|
||||
return;
|
||||
}
|
||||
|
||||
// if the table is already at the current version, then we can exit immediately
|
||||
if (oldVersion.StartsWith("Rev. 2;"))
|
||||
{
|
||||
m_log.Info("[INVENTORY DB]: Upgrading inventory items table from Rev. 2 to Rev. 3");
|
||||
database.ExecuteResourceSql("UpgradeItemsTableToVersion3.sql");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="conn">MySQL connection handler</param>
|
||||
/// <param name="m"></param>
|
||||
private void TestTables(MySqlConnection conn, Migration m)
|
||||
{
|
||||
Dictionary<string, string> tableList = new Dictionary<string, string>();
|
||||
|
||||
tableList["inventoryfolders"] = null;
|
||||
tableList["inventoryitems"] = 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["inventoryfolders"] == null &&
|
||||
tableList["inventoryitems"] == null
|
||||
)
|
||||
return;
|
||||
|
||||
// otherwise, let the upgrade on legacy proceed...
|
||||
UpgradeFoldersTable(tableList["inventoryfolders"]);
|
||||
UpgradeItemsTable(tableList["inventoryitems"]);
|
||||
|
||||
// ... and set the version
|
||||
if (m.Version == 0)
|
||||
m.Version = 1;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The name of this DB provider
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue