From e1140a4f9ba4b0d6b62002927dcde27d85a22ff0 Mon Sep 17 00:00:00 2001
From: Sean Dague
Date: Thu, 12 Jun 2008 15:47:33 +0000
Subject: this, in theory, adds migration support to mysql for all data sources
besides the grid store. It is only lightly tested so the less adventurous
should wait a couple of checkins before upgrading.
---
OpenSim/Data/MySQL/MySQLUserData.cs | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Data/MySQL/MySQLUserData.cs')
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs
index f717609..7d2da3a 100644
--- a/OpenSim/Data/MySQL/MySQLUserData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserData.cs
@@ -105,7 +105,15 @@ namespace OpenSim.Data.MySQL
database = new MySQLManager(m_connectString);
}
- TestTables();
+ // This actually does the roll forward assembly stuff
+ Assembly assem = GetType().Assembly;
+ Migration m = new Migration(database.Connection, assem, "AssetStore");
+
+ // TODO: After rev 6000, remove this. People should have
+ // been rolled onto the new migration code by then.
+ TestTables(m);
+
+ m.Update();
}
#region Test and initialization code
@@ -113,7 +121,7 @@ namespace OpenSim.Data.MySQL
///
/// Ensure that the user related tables exists and are at the latest version
///
- private void TestTables()
+ private void TestTables(Migration m)
{
Dictionary tableList = new Dictionary();
@@ -123,10 +131,30 @@ namespace OpenSim.Data.MySQL
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;
}
///
--
cgit v1.1