aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLUserData.cs120
1 files changed, 0 insertions, 120 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs
index caae677..e04d36a 100644
--- a/OpenSim/Data/MySQL/MySQLUserData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserData.cs
@@ -121,131 +121,11 @@ namespace OpenSim.Data.MySQL
121 Assembly assem = GetType().Assembly; 121 Assembly assem = GetType().Assembly;
122 Migration m = new Migration(database.Connection, assem, "UserStore"); 122 Migration m = new Migration(database.Connection, assem, "UserStore");
123 123
124 // TODO: After rev 6000, remove this. People should have
125 // been rolled onto the new migration code by then.
126 TestTables(m);
127
128 m.Update(); 124 m.Update();
129 } 125 }
130 126
131 public override void Dispose () { } 127 public override void Dispose () { }
132 128
133
134 #region Test and initialization code
135
136 /// <summary>
137 /// Ensure that the user related tables exists and are at the latest version
138 /// </summary>
139 private void TestTables(Migration m)
140 {
141 Dictionary<string, string> tableList = new Dictionary<string, string>();
142
143 tableList[m_agentsTableName] = null;
144 tableList[m_usersTableName] = null;
145 tableList[m_userFriendsTableName] = null;
146 tableList[m_appearanceTableName] = null;
147 database.GetTableVersion(tableList);
148
149 // if we've already started using migrations, get out of
150 // here, we've got this under control
151 if (m.Version > 0)
152 return;
153
154 // if there are no tables, get out of here and let
155 // migrations do their job
156 if (
157 tableList[m_agentsTableName] == null &&
158 tableList[m_usersTableName] == null &&
159 tableList[m_userFriendsTableName] == null &&
160 tableList[m_appearanceTableName] == null
161 )
162 return;
163
164 // otherwise, let the upgrade on legacy proceed...
165 UpgradeAgentsTable(tableList[m_agentsTableName]);
166 UpgradeUsersTable(tableList[m_usersTableName]);
167 UpgradeFriendsTable(tableList[m_userFriendsTableName]);
168 UpgradeAppearanceTable(tableList[m_appearanceTableName]);
169
170 // ... and set the version
171 if (m.Version == 0)
172 m.Version = 1;
173 }
174
175 /// <summary>
176 /// Create or upgrade the table if necessary
177 /// </summary>
178 /// <param name="oldVersion">A null indicates that the table does not
179 /// currently exist</param>
180 private void UpgradeAgentsTable(string oldVersion)
181 {
182 // null as the version, indicates that the table didn't exist
183 if (oldVersion == null)
184 {
185 database.ExecuteResourceSql("CreateAgentsTable.sql");
186 return;
187 }
188 }
189
190 /// <summary>
191 /// Create or upgrade the table if necessary
192 /// </summary>
193 /// <param name="oldVersion">A null indicates that the table does not
194 /// currently exist</param>
195 private void UpgradeUsersTable(string oldVersion)
196 {
197 // null as the version, indicates that the table didn't exist
198 if (oldVersion == null)
199 {
200 database.ExecuteResourceSql("CreateUsersTable.sql");
201 return;
202 }
203 else if (oldVersion.Contains("Rev. 1"))
204 {
205 database.ExecuteResourceSql("UpgradeUsersTableToVersion2.sql");
206 return;
207 }
208 //m_log.Info("[DB]: DBVers:" + oldVersion);
209 }
210
211 /// <summary>
212 /// Create or upgrade the table if necessary
213 /// </summary>
214 /// <param name="oldVersion">A null indicates that the table does not
215 /// currently exist</param>
216 private void UpgradeFriendsTable(string oldVersion)
217 {
218 // null as the version, indicates that the table didn't exist
219 if (oldVersion == null)
220 {
221 database.ExecuteResourceSql("CreateUserFriendsTable.sql");
222 return;
223 }
224 }
225
226 /// <summary>
227 /// Create or upgrade the table if necessary
228 /// </summary>
229 /// <param name="oldVersion">A null indicates that the table does not
230 /// currently exist</param>
231 private void UpgradeAppearanceTable(string oldVersion)
232 {
233 // null as the version, indicates that the table didn't exist
234 if (oldVersion == null)
235 {
236 database.ExecuteResourceSql("CreateAvatarAppearance.sql");
237 return;
238 }
239 else if (oldVersion.Contains("Rev.1"))
240 {
241 database.ExecuteSql("drop table avatarappearance");
242 database.ExecuteResourceSql("CreateAvatarAppearance.sql");
243 return;
244 }
245 }
246
247 #endregion
248
249 // see IUserDataPlugin 129 // see IUserDataPlugin
250 override public UserProfileData GetUserByName(string user, string last) 130 override public UserProfileData GetUserByName(string user, string last)
251 { 131 {