From 9052c43319ab69f57b80e363d965780be625b0e2 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 2 Jul 2008 16:20:54 +0000 Subject: * Drop InvType from the assets table since it is no longer used * Migration should be automatic on sqlite and mysql * Migration is not automatic on mssql, you will need to drop the invType column manually * Migration should be fine, but as for any db change, I would recommend making sure you have backups before moving past this revision --- OpenSim/Data/SQLite/Resources/002_AssetStore.sql | 10 ++++++++++ OpenSim/Data/SQLite/SQLiteAssetData.cs | 12 ++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 OpenSim/Data/SQLite/Resources/002_AssetStore.sql (limited to 'OpenSim/Data/SQLite') diff --git a/OpenSim/Data/SQLite/Resources/002_AssetStore.sql b/OpenSim/Data/SQLite/Resources/002_AssetStore.sql new file mode 100644 index 0000000..41ca640 --- /dev/null +++ b/OpenSim/Data/SQLite/Resources/002_AssetStore.sql @@ -0,0 +1,10 @@ +BEGIN TRANSACTION; + +CREATE TEMPORARY TABLE assets_backup(UUID,Name,Description,Type,Local,Temporary,Data); +INSERT INTO assets_backup SELECT UUID,Name,Description,Type,Local,Temporary,Data FROM assets; +DROP TABLE assets; +CREATE TABLE assets(UUID,Name,Description,Type,Local,Temporary,Data); +INSERT INTO assets SELECT UUID,Name,Description,Type,Local,Temporary,Data FROM assets_backup; +DROP TABLE assets_backup; + +COMMIT; diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 24c75e3..8fa09fc 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs @@ -50,8 +50,8 @@ namespace OpenSim.Data.SQLite /// private const string SelectAssetSQL = "select * from assets where UUID=:UUID"; private const string DeleteAssetSQL = "delete from assets where UUID=:UUID"; - private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, InvType, Local, Temporary, Data) values(:UUID, :Name, :Description, :Type, :InvType, :Local, :Temporary, :Data)"; - private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, InvType=:InvType, Local=:Local, Temporary=:Temporary, Data=:Data where UUID=:UUID"; + private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, Local, Temporary, Data) values(:UUID, :Name, :Description, :Type, :Local, :Temporary, :Data)"; + private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, Local=:Local, Temporary=:Temporary, Data=:Data where UUID=:UUID"; private const string assetSelect = "select * from assets"; private SqliteConnection m_conn; @@ -134,7 +134,6 @@ namespace OpenSim.Data.SQLite cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); - cmd.Parameters.Add(new SqliteParameter(":InvType", asset.InvType)); cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); @@ -158,7 +157,6 @@ namespace OpenSim.Data.SQLite cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); - cmd.Parameters.Add(new SqliteParameter(":InvType", asset.InvType)); cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); @@ -180,9 +178,9 @@ namespace OpenSim.Data.SQLite int assetLength = (asset.Data != null) ? asset.Data.Length : 0; m_log.Info("[ASSET DB]: " + - string.Format("Loaded {6} {5} Asset: [{0}][{3}/{4}] \"{1}\":{2} ({7} bytes)", + string.Format("Loaded {6} {5} Asset: [{0}][{3}] \"{1}\":{2} ({7} bytes)", asset.FullID, asset.Name, asset.Description, asset.Type, - asset.InvType, temporary, local, assetLength)); + temporary, local, assetLength)); } /// @@ -258,7 +256,6 @@ namespace OpenSim.Data.SQLite // SQLiteUtil.createCol(assets, "Name", typeof (String)); // SQLiteUtil.createCol(assets, "Description", typeof (String)); // SQLiteUtil.createCol(assets, "Type", typeof (Int32)); - // SQLiteUtil.createCol(assets, "InvType", typeof (Int32)); // SQLiteUtil.createCol(assets, "Local", typeof (Boolean)); // SQLiteUtil.createCol(assets, "Temporary", typeof (Boolean)); // SQLiteUtil.createCol(assets, "Data", typeof (Byte[])); @@ -291,7 +288,6 @@ namespace OpenSim.Data.SQLite asset.Name = (String) row["Name"]; asset.Description = (String) row["Description"]; asset.Type = Convert.ToSByte(row["Type"]); - asset.InvType = Convert.ToSByte(row["InvType"]); asset.Local = Convert.ToBoolean(row["Local"]); asset.Temporary = Convert.ToBoolean(row["Temporary"]); asset.Data = (byte[]) row["Data"]; -- cgit v1.1