diff options
author | Sean Dague | 2008-06-16 14:10:51 +0000 |
---|---|---|
committer | Sean Dague | 2008-06-16 14:10:51 +0000 |
commit | ec78a2871bedd951844be01490fcb85e22dac178 (patch) | |
tree | 8d22fbfcc18697021e0c2611f98a30de13c6c461 /OpenSim/Data | |
parent | * 0001558: [PATCH] Add support for full collision geometry feature set for li... (diff) | |
download | opensim-SC_OLD-ec78a2871bedd951844be01490fcb85e22dac178.zip opensim-SC_OLD-ec78a2871bedd951844be01490fcb85e22dac178.tar.gz opensim-SC_OLD-ec78a2871bedd951844be01490fcb85e22dac178.tar.bz2 opensim-SC_OLD-ec78a2871bedd951844be01490fcb85e22dac178.tar.xz |
the beginning of the great id format migration. This makes
asset uuids no longer binary. I've tested this migration a
few times, and it seems working in all the scenarios I've found
but it wouldn't hurt to backup your asset db before running this
as it does touch a very sensitive part of our content system.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/Migration.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAssetData.cs | 10 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/002_AssetStore.sql | 9 |
3 files changed, 15 insertions, 6 deletions
diff --git a/OpenSim/Data/Migration.cs b/OpenSim/Data/Migration.cs index d23200c..45b44b9 100644 --- a/OpenSim/Data/Migration.cs +++ b/OpenSim/Data/Migration.cs | |||
@@ -222,6 +222,8 @@ namespace OpenSim.Data | |||
222 | { | 222 | { |
223 | string[] names = _assem.GetManifestResourceNames(); | 223 | string[] names = _assem.GetManifestResourceNames(); |
224 | SortedList<int, string> migrations = new SortedList<int, string>(); | 224 | SortedList<int, string> migrations = new SortedList<int, string>(); |
225 | // because life is funny if we don't | ||
226 | Array.Sort(names); | ||
225 | 227 | ||
226 | foreach (string s in names) | 228 | foreach (string s in names) |
227 | { | 229 | { |
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index f51eee2..3cda5b8 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -125,8 +125,7 @@ namespace OpenSim.Data.MySQL | |||
125 | new MySqlCommand( | 125 | new MySqlCommand( |
126 | "SELECT name, description, assetType, invType, local, temporary, data FROM assets WHERE id=?id", | 126 | "SELECT name, description, assetType, invType, local, temporary, data FROM assets WHERE id=?id", |
127 | _dbConnection.Connection); | 127 | _dbConnection.Connection); |
128 | MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); | 128 | cmd.Parameters.AddWithValue("?id", assetID.ToString()); |
129 | p.Value = assetID.GetBytes(); | ||
130 | 129 | ||
131 | try | 130 | try |
132 | { | 131 | { |
@@ -180,8 +179,7 @@ namespace OpenSim.Data.MySQL | |||
180 | { | 179 | { |
181 | using (cmd) | 180 | using (cmd) |
182 | { | 181 | { |
183 | MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); | 182 | cmd.Parameters.AddWithValue("?id", asset.FullID.ToString()); |
184 | p.Value = asset.FullID.GetBytes(); | ||
185 | cmd.Parameters.AddWithValue("?name", asset.Name); | 183 | cmd.Parameters.AddWithValue("?name", asset.Name); |
186 | cmd.Parameters.AddWithValue("?description", asset.Description); | 184 | cmd.Parameters.AddWithValue("?description", asset.Description); |
187 | cmd.Parameters.AddWithValue("?assetType", asset.Type); | 185 | cmd.Parameters.AddWithValue("?assetType", asset.Type); |
@@ -219,8 +217,8 @@ namespace OpenSim.Data.MySQL | |||
219 | new MySqlCommand( | 217 | new MySqlCommand( |
220 | "SELECT id FROM assets WHERE id=?id", | 218 | "SELECT id FROM assets WHERE id=?id", |
221 | _dbConnection.Connection); | 219 | _dbConnection.Connection); |
222 | MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); | 220 | |
223 | p.Value = uuid.GetBytes(); | 221 | cmd.Parameters.AddWithValue("?id", uuid.ToString()); |
224 | 222 | ||
225 | try | 223 | try |
226 | { | 224 | { |
diff --git a/OpenSim/Data/MySQL/Resources/002_AssetStore.sql b/OpenSim/Data/MySQL/Resources/002_AssetStore.sql new file mode 100644 index 0000000..a7d7fca --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/002_AssetStore.sql | |||
@@ -0,0 +1,9 @@ | |||
1 | BEGIN; | ||
2 | |||
3 | ALTER TABLE assets change id oldid binary(16); | ||
4 | ALTER TABLE assets add id varchar(36) not null default ''; | ||
5 | UPDATE assets set id = concat(substr(hex(oldid),1,8),"-",substr(hex(oldid),9,4),"-",substr(hex(oldid),13,4),"-",substr(hex(oldid),17,4),"-",substr(hex(oldid),21,12)); | ||
6 | ALTER TABLE assets drop oldid; | ||
7 | ALTER TABLE assets add constraint primary key(id); | ||
8 | |||
9 | COMMIT; \ No newline at end of file | ||