From 9b22393cf308507dc751704c8b0d3e65ac1d4323 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 9 May 2010 17:02:22 +0100 Subject: Add a field asset_flags and a corresponding enum to the asset database. This CHANGES THE ASSET SERVER PROTOCOL and means you CAN NOT MIX PRIOR VERSIONS WITH LATER ONES. It may also eat your babies, yada, yada, yada. The usual cautions for migrations to the assets table apply. Coding: Can not guarantee nut free. --- OpenSim/Data/MySQL/MySQLAssetData.cs | 8 +++++--- OpenSim/Data/MySQL/Resources/007_AssetStore.sql | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 OpenSim/Data/MySQL/Resources/007_AssetStore.sql (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index d55369a..5a2af4f 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -161,8 +161,8 @@ namespace OpenSim.Data.MySQL MySqlCommand cmd = new MySqlCommand( - "replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, data)" + - "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?data)", + "replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, data)" + + "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?data)", dbcon); string assetName = asset.Name; @@ -194,6 +194,7 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("?temporary", asset.Temporary); cmd.Parameters.AddWithValue("?create_time", now); cmd.Parameters.AddWithValue("?access_time", now); + cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); cmd.Parameters.AddWithValue("?data", asset.Data); cmd.ExecuteNonQuery(); cmd.Dispose(); @@ -302,7 +303,7 @@ namespace OpenSim.Data.MySQL using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) { dbcon.Open(); - MySqlCommand cmd = new MySqlCommand("SELECT name,description,assetType,temporary,id FROM assets LIMIT ?start, ?count", dbcon); + MySqlCommand cmd = new MySqlCommand("SELECT name,description,assetType,temporary,id,asset_flags FROM assets LIMIT ?start, ?count", dbcon); cmd.Parameters.AddWithValue("?start", start); cmd.Parameters.AddWithValue("?count", count); @@ -317,6 +318,7 @@ namespace OpenSim.Data.MySQL metadata.Description = (string)dbReader["description"]; metadata.Type = (sbyte)dbReader["assetType"]; metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct. + metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]); metadata.FullID = new UUID((string)dbReader["id"]); // Current SHA1s are not stored/computed. diff --git a/OpenSim/Data/MySQL/Resources/007_AssetStore.sql b/OpenSim/Data/MySQL/Resources/007_AssetStore.sql new file mode 100644 index 0000000..f06121a --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/007_AssetStore.sql @@ -0,0 +1,5 @@ +BEGIN; + +ALTER TABLE assets ADD COLUMN asset_flags INTEGER NOT NULL DEFAULT 0; + +COMMIT; -- cgit v1.1