diff options
author | Sean Dague | 2008-06-12 15:47:33 +0000 |
---|---|---|
committer | Sean Dague | 2008-06-12 15:47:33 +0000 |
commit | e1140a4f9ba4b0d6b62002927dcde27d85a22ff0 (patch) | |
tree | e1f010c1108afa1b424e0b065d9f743f07fed512 /OpenSim/Data/MySQL/MySQLUserData.cs | |
parent | check in region store initial migration definition, (diff) | |
download | opensim-SC-e1140a4f9ba4b0d6b62002927dcde27d85a22ff0.zip opensim-SC-e1140a4f9ba4b0d6b62002927dcde27d85a22ff0.tar.gz opensim-SC-e1140a4f9ba4b0d6b62002927dcde27d85a22ff0.tar.bz2 opensim-SC-e1140a4f9ba4b0d6b62002927dcde27d85a22ff0.tar.xz |
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.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserData.cs | 32 |
1 files changed, 30 insertions, 2 deletions
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 | |||
105 | database = new MySQLManager(m_connectString); | 105 | database = new MySQLManager(m_connectString); |
106 | } | 106 | } |
107 | 107 | ||
108 | TestTables(); | 108 | // This actually does the roll forward assembly stuff |
109 | Assembly assem = GetType().Assembly; | ||
110 | Migration m = new Migration(database.Connection, assem, "AssetStore"); | ||
111 | |||
112 | // TODO: After rev 6000, remove this. People should have | ||
113 | // been rolled onto the new migration code by then. | ||
114 | TestTables(m); | ||
115 | |||
116 | m.Update(); | ||
109 | } | 117 | } |
110 | 118 | ||
111 | #region Test and initialization code | 119 | #region Test and initialization code |
@@ -113,7 +121,7 @@ namespace OpenSim.Data.MySQL | |||
113 | /// <summary> | 121 | /// <summary> |
114 | /// Ensure that the user related tables exists and are at the latest version | 122 | /// Ensure that the user related tables exists and are at the latest version |
115 | /// </summary> | 123 | /// </summary> |
116 | private void TestTables() | 124 | private void TestTables(Migration m) |
117 | { | 125 | { |
118 | Dictionary<string, string> tableList = new Dictionary<string, string>(); | 126 | Dictionary<string, string> tableList = new Dictionary<string, string>(); |
119 | 127 | ||
@@ -123,10 +131,30 @@ namespace OpenSim.Data.MySQL | |||
123 | tableList[m_appearanceTableName] = null; | 131 | tableList[m_appearanceTableName] = null; |
124 | database.GetTableVersion(tableList); | 132 | database.GetTableVersion(tableList); |
125 | 133 | ||
134 | // if we've already started using migrations, get out of | ||
135 | // here, we've got this under control | ||
136 | if (m.Version > 0) | ||
137 | return; | ||
138 | |||
139 | // if there are no tables, get out of here and let | ||
140 | // migrations do their job | ||
141 | if( | ||
142 | tableList[m_agentsTableName] == null && | ||
143 | tableList[m_usersTableName] == null && | ||
144 | tableList[m_userFriendsTableName] == null && | ||
145 | tableList[m_appearanceTableName] == null | ||
146 | ) | ||
147 | return; | ||
148 | |||
149 | // otherwise, let the upgrade on legacy proceed... | ||
126 | UpgradeAgentsTable(tableList[m_agentsTableName]); | 150 | UpgradeAgentsTable(tableList[m_agentsTableName]); |
127 | UpgradeUsersTable(tableList[m_usersTableName]); | 151 | UpgradeUsersTable(tableList[m_usersTableName]); |
128 | UpgradeFriendsTable(tableList[m_userFriendsTableName]); | 152 | UpgradeFriendsTable(tableList[m_userFriendsTableName]); |
129 | UpgradeAppearanceTable(tableList[m_appearanceTableName]); | 153 | UpgradeAppearanceTable(tableList[m_appearanceTableName]); |
154 | |||
155 | // ... and set the version | ||
156 | if (m.Version == 0) | ||
157 | m.Version = 1; | ||
130 | } | 158 | } |
131 | 159 | ||
132 | /// <summary> | 160 | /// <summary> |