aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLAssetData.cs
diff options
context:
space:
mode:
authorSean Dague2008-06-12 15:47:33 +0000
committerSean Dague2008-06-12 15:47:33 +0000
commite1140a4f9ba4b0d6b62002927dcde27d85a22ff0 (patch)
treee1f010c1108afa1b424e0b065d9f743f07fed512 /OpenSim/Data/MySQL/MySQLAssetData.cs
parentcheck in region store initial migration definition, (diff)
downloadopensim-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 'OpenSim/Data/MySQL/MySQLAssetData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs84
1 files changed, 50 insertions, 34 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index a2215ef..f51eee2 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -42,6 +42,48 @@ namespace OpenSim.Data.MySQL
42 42
43 private MySQLManager _dbConnection; 43 private MySQLManager _dbConnection;
44 44
45 #region IPlugin Members
46
47 override public void Initialise(string connect)
48 {
49 // TODO: This will let you pass in the connect string in
50 // the config, though someone will need to write that.
51 if (connect == String.Empty)
52 {
53 // This is old seperate config file
54 m_log.Warn("no connect string, using old mysql_connection.ini instead");
55 Initialise();
56 }
57 else
58 {
59 _dbConnection = new MySQLManager(connect);
60 }
61
62 // This actually does the roll forward assembly stuff
63 Assembly assem = GetType().Assembly;
64 Migration m = new Migration(_dbConnection.Connection, assem, "AssetStore");
65
66 // TODO: After rev 6000, remove this. People should have
67 // been rolled onto the new migration code by then.
68 TestTables(m);
69
70 m.Update();
71 }
72
73 override public void Initialise()
74 {
75 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
76 string hostname = GridDataMySqlFile.ParseFileReadValue("hostname");
77 string database = GridDataMySqlFile.ParseFileReadValue("database");
78 string username = GridDataMySqlFile.ParseFileReadValue("username");
79 string password = GridDataMySqlFile.ParseFileReadValue("password");
80 string pooling = GridDataMySqlFile.ParseFileReadValue("pooling");
81 string port = GridDataMySqlFile.ParseFileReadValue("port");
82
83 _dbConnection = new MySQLManager(hostname, database, username, password, pooling, port);
84
85 }
86
45 #region IAssetProvider Members 87 #region IAssetProvider Members
46 88
47 private void UpgradeAssetsTable(string oldVersion) 89 private void UpgradeAssetsTable(string oldVersion)
@@ -58,14 +100,20 @@ namespace OpenSim.Data.MySQL
58 /// <summary> 100 /// <summary>
59 /// Ensure that the assets related tables exists and are at the latest version 101 /// Ensure that the assets related tables exists and are at the latest version
60 /// </summary> 102 /// </summary>
61 private void TestTables() 103 private void TestTables(Migration m)
62 { 104 {
63 Dictionary<string, string> tableList = new Dictionary<string, string>(); 105 Dictionary<string, string> tableList = new Dictionary<string, string>();
64 106
65 tableList["assets"] = null; 107 tableList["assets"] = null;
66 _dbConnection.GetTableVersion(tableList); 108 _dbConnection.GetTableVersion(tableList);
67 109
68 UpgradeAssetsTable(tableList["assets"]); 110 // if there is no table, return, migrations will handle it.
111 if (tableList["assets"] == null)
112 return;
113
114 // if there is a table, and we don't have a migration, set it to 1
115 if (m.Version == 0)
116 m.Version = 1;
69 } 117 }
70 118
71 override public AssetBase FetchAsset(LLUUID assetID) 119 override public AssetBase FetchAsset(LLUUID assetID)
@@ -208,38 +256,6 @@ namespace OpenSim.Data.MySQL
208 256
209 #endregion 257 #endregion
210 258
211 #region IPlugin Members
212
213 override public void Initialise(string connect)
214 {
215 // TODO: This will let you pass in the connect string in
216 // the config, though someone will need to write that.
217 if (connect == String.Empty)
218 {
219 // This is old seperate config file
220 Initialise();
221 }
222 else
223 {
224 _dbConnection = new MySQLManager(connect);
225 TestTables();
226 }
227 }
228
229 override public void Initialise()
230 {
231 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
232 string hostname = GridDataMySqlFile.ParseFileReadValue("hostname");
233 string database = GridDataMySqlFile.ParseFileReadValue("database");
234 string username = GridDataMySqlFile.ParseFileReadValue("username");
235 string password = GridDataMySqlFile.ParseFileReadValue("password");
236 string pooling = GridDataMySqlFile.ParseFileReadValue("pooling");
237 string port = GridDataMySqlFile.ParseFileReadValue("port");
238
239 _dbConnection = new MySQLManager(hostname, database, username, password, pooling, port);
240
241 TestTables();
242 }
243 259
244 override public string Version 260 override public string Version
245 { 261 {