* 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
0.6.0-stable
Justin Clarke Casey 2008-07-02 16:20:54 +00:00
parent 1deaa50240
commit 9052c43319
13 changed files with 25 additions and 45 deletions

View File

@ -223,7 +223,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
rdata.writer.WriteAttributeString("name", asset.Name); rdata.writer.WriteAttributeString("name", asset.Name);
rdata.writer.WriteAttributeString("desc", asset.Description); rdata.writer.WriteAttributeString("desc", asset.Description);
rdata.writer.WriteAttributeString("type", asset.Type.ToString()); rdata.writer.WriteAttributeString("type", asset.Type.ToString());
rdata.writer.WriteAttributeString("invtype", asset.InvType.ToString());
rdata.writer.WriteAttributeString("local", asset.Local.ToString()); rdata.writer.WriteAttributeString("local", asset.Local.ToString());
rdata.writer.WriteAttributeString("temporary", asset.Temporary.ToString()); rdata.writer.WriteAttributeString("temporary", asset.Temporary.ToString());

View File

@ -1492,7 +1492,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
private void CollectAsset(XmlInventoryCollection ic) private void CollectAsset(XmlInventoryCollection ic)
{ {
Rest.Log.DebugFormat("{0} Interpret asset element", MsgId); Rest.Log.DebugFormat("{0} Interpret asset element", MsgId);
AssetBase asset = null; AssetBase asset = null;
@ -1500,7 +1499,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
string name = String.Empty; string name = String.Empty;
string desc = String.Empty; string desc = String.Empty;
sbyte type = (sbyte) AssetType.Unknown; sbyte type = (sbyte) AssetType.Unknown;
sbyte itype = (sbyte) AssetType.Unknown;
bool temp = false; bool temp = false;
bool local = false; bool local = false;
@ -1534,10 +1532,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
temp = Boolean.Parse(ic.xml.Value); temp = Boolean.Parse(ic.xml.Value);
break; break;
case "invtype" :
itype = SByte.Parse(ic.xml.Value);
break;
case "uuid" : case "uuid" :
uuid = new LLUUID(ic.xml.Value); uuid = new LLUUID(ic.xml.Value);
break; break;
@ -1603,7 +1597,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
asset.Description = desc; asset.Description = desc;
asset.Type = type; // type == 0 == texture asset.Type = type; // type == 0 == texture
asset.InvType = itype;
asset.Local = local; asset.Local = local;
asset.Temporary = temp; asset.Temporary = temp;

View File

@ -63,6 +63,7 @@ namespace OpenSim.Data.MSSQL
database.ExecuteResourceSql("CreateAssetsTable.sql"); database.ExecuteResourceSql("CreateAssetsTable.sql");
return; return;
} }
} }
/// <summary> /// <summary>
@ -114,9 +115,9 @@ namespace OpenSim.Data.MSSQL
SqlCommand cmd = SqlCommand cmd =
new SqlCommand( new SqlCommand(
"INSERT INTO assets ([id], [name], [description], [assetType], [invType], [local], [temporary], [data])" + "INSERT INTO assets ([id], [name], [description], [assetType], [local], [temporary], [data])" +
" VALUES " + " VALUES " +
"(@id, @name, @description, @assetType, @invType, @local, @temporary, @data)", "(@id, @name, @description, @assetType, @local, @temporary, @data)",
database.getConnection()); database.getConnection());
using (cmd) using (cmd)
@ -128,8 +129,6 @@ namespace OpenSim.Data.MSSQL
cmd.Parameters.AddWithValue("description", asset.Description); cmd.Parameters.AddWithValue("description", asset.Description);
SqlParameter e = cmd.Parameters.Add("assetType", SqlDbType.TinyInt); SqlParameter e = cmd.Parameters.Add("assetType", SqlDbType.TinyInt);
e.Value = asset.Type; e.Value = asset.Type;
SqlParameter f = cmd.Parameters.Add("invType", SqlDbType.TinyInt);
f.Value = asset.InvType;
SqlParameter g = cmd.Parameters.Add("local", SqlDbType.TinyInt); SqlParameter g = cmd.Parameters.Add("local", SqlDbType.TinyInt);
g.Value = asset.Local; g.Value = asset.Local;
SqlParameter h = cmd.Parameters.Add("temporary", SqlDbType.TinyInt); SqlParameter h = cmd.Parameters.Add("temporary", SqlDbType.TinyInt);
@ -159,7 +158,6 @@ namespace OpenSim.Data.MSSQL
"name = @name, " + "name = @name, " +
"description = @description," + "description = @description," +
"assetType = @assetType," + "assetType = @assetType," +
"invType = @invType," +
"local = @local," + "local = @local," +
"temporary = @temporary," + "temporary = @temporary," +
"data = @data where " + "data = @data where " +
@ -168,7 +166,6 @@ namespace OpenSim.Data.MSSQL
SqlParameter param2 = new SqlParameter("@name", asset.Name); SqlParameter param2 = new SqlParameter("@name", asset.Name);
SqlParameter param3 = new SqlParameter("@description", asset.Description); SqlParameter param3 = new SqlParameter("@description", asset.Description);
SqlParameter param4 = new SqlParameter("@assetType", asset.Type); SqlParameter param4 = new SqlParameter("@assetType", asset.Type);
SqlParameter param5 = new SqlParameter("@invType", asset.InvType);
SqlParameter param6 = new SqlParameter("@local", asset.Local); SqlParameter param6 = new SqlParameter("@local", asset.Local);
SqlParameter param7 = new SqlParameter("@temporary", asset.Temporary); SqlParameter param7 = new SqlParameter("@temporary", asset.Temporary);
SqlParameter param8 = new SqlParameter("@data", asset.Data); SqlParameter param8 = new SqlParameter("@data", asset.Data);
@ -177,7 +174,6 @@ namespace OpenSim.Data.MSSQL
command.Parameters.Add(param2); command.Parameters.Add(param2);
command.Parameters.Add(param3); command.Parameters.Add(param3);
command.Parameters.Add(param4); command.Parameters.Add(param4);
command.Parameters.Add(param5);
command.Parameters.Add(param6); command.Parameters.Add(param6);
command.Parameters.Add(param7); command.Parameters.Add(param7);
command.Parameters.Add(param8); command.Parameters.Add(param8);

View File

@ -405,7 +405,6 @@ namespace OpenSim.Data.MSSQL
asset.Data = (byte[])reader["data"]; asset.Data = (byte[])reader["data"];
asset.Description = (string)reader["description"]; asset.Description = (string)reader["description"];
asset.FullID = new LLUUID((string)reader["id"]); asset.FullID = new LLUUID((string)reader["id"]);
asset.InvType = Convert.ToSByte(reader["invType"]);
asset.Local = Convert.ToBoolean(reader["local"]); // ((sbyte)reader["local"]) != 0 ? true : false; asset.Local = Convert.ToBoolean(reader["local"]); // ((sbyte)reader["local"]) != 0 ? true : false;
asset.Name = (string)reader["name"]; asset.Name = (string)reader["name"];
asset.Type = Convert.ToSByte(reader["assetType"]); asset.Type = Convert.ToSByte(reader["assetType"]);

View File

@ -6,7 +6,6 @@ CREATE TABLE [assets] (
[name] [varchar](64) NOT NULL, [name] [varchar](64) NOT NULL,
[description] [varchar](64) NOT NULL, [description] [varchar](64) NOT NULL,
[assetType] [tinyint] NOT NULL, [assetType] [tinyint] NOT NULL,
[invType] [tinyint] NOT NULL,
[local] [tinyint] NOT NULL, [local] [tinyint] NOT NULL,
[temporary] [tinyint] NOT NULL, [temporary] [tinyint] NOT NULL,
[data] [image] NOT NULL, [data] [image] NOT NULL,

View File

@ -164,7 +164,7 @@ namespace OpenSim.Data.MySQL
{ {
MySqlCommand cmd = MySqlCommand cmd =
new MySqlCommand( new MySqlCommand(
"SELECT name, description, assetType, invType, local, temporary, data FROM assets WHERE id=?id", "SELECT name, description, assetType, local, temporary, data FROM assets WHERE id=?id",
_dbConnection.Connection); _dbConnection.Connection);
cmd.Parameters.AddWithValue("?id", assetID.ToString()); cmd.Parameters.AddWithValue("?id", assetID.ToString());
@ -178,7 +178,6 @@ namespace OpenSim.Data.MySQL
asset.Data = (byte[]) dbReader["data"]; asset.Data = (byte[]) dbReader["data"];
asset.Description = (string) dbReader["description"]; asset.Description = (string) dbReader["description"];
asset.FullID = assetID; asset.FullID = assetID;
asset.InvType = (sbyte) dbReader["invType"];
asset.Local = ((sbyte) dbReader["local"]) != 0 ? true : false; asset.Local = ((sbyte) dbReader["local"]) != 0 ? true : false;
asset.Name = (string) dbReader["name"]; asset.Name = (string) dbReader["name"];
asset.Type = (sbyte) dbReader["assetType"]; asset.Type = (sbyte) dbReader["assetType"];
@ -216,8 +215,8 @@ namespace OpenSim.Data.MySQL
MySqlCommand cmd = MySqlCommand cmd =
new MySqlCommand( new MySqlCommand(
"REPLACE INTO assets(id, name, description, assetType, invType, local, temporary, data)" + "REPLACE INTO assets(id, name, description, assetType, local, temporary, data)" +
"VALUES(?id, ?name, ?description, ?assetType, ?invType, ?local, ?temporary, ?data)", "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?data)",
_dbConnection.Connection); _dbConnection.Connection);
// need to ensure we dispose // need to ensure we dispose
@ -229,7 +228,6 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?name", asset.Name); cmd.Parameters.AddWithValue("?name", asset.Name);
cmd.Parameters.AddWithValue("?description", asset.Description); cmd.Parameters.AddWithValue("?description", asset.Description);
cmd.Parameters.AddWithValue("?assetType", asset.Type); cmd.Parameters.AddWithValue("?assetType", asset.Type);
cmd.Parameters.AddWithValue("?invType", asset.InvType);
cmd.Parameters.AddWithValue("?local", asset.Local); cmd.Parameters.AddWithValue("?local", asset.Local);
cmd.Parameters.AddWithValue("?temporary", asset.Temporary); cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
cmd.Parameters.AddWithValue("?data", asset.Data); cmd.Parameters.AddWithValue("?data", asset.Data);

View File

@ -0,0 +1,5 @@
BEGIN;
ALTER TABLE assets drop InvType;
COMMIT;

View File

@ -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;

View File

@ -50,8 +50,8 @@ namespace OpenSim.Data.SQLite
/// </summary> /// </summary>
private const string SelectAssetSQL = "select * from assets where UUID=:UUID"; private const string SelectAssetSQL = "select * from assets where UUID=:UUID";
private const string DeleteAssetSQL = "delete 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 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, InvType=:InvType, Local=:Local, Temporary=:Temporary, Data=:Data where UUID=:UUID"; 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 const string assetSelect = "select * from assets";
private SqliteConnection m_conn; 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(":Name", asset.Name));
cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description));
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); 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(":Local", asset.Local));
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); 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(":Name", asset.Name));
cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description));
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); 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(":Local", asset.Local));
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); 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; int assetLength = (asset.Data != null) ? asset.Data.Length : 0;
m_log.Info("[ASSET DB]: " + 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.FullID, asset.Name, asset.Description, asset.Type,
asset.InvType, temporary, local, assetLength)); temporary, local, assetLength));
} }
/// <summary> /// <summary>
@ -258,7 +256,6 @@ namespace OpenSim.Data.SQLite
// SQLiteUtil.createCol(assets, "Name", typeof (String)); // SQLiteUtil.createCol(assets, "Name", typeof (String));
// SQLiteUtil.createCol(assets, "Description", typeof (String)); // SQLiteUtil.createCol(assets, "Description", typeof (String));
// SQLiteUtil.createCol(assets, "Type", typeof (Int32)); // SQLiteUtil.createCol(assets, "Type", typeof (Int32));
// SQLiteUtil.createCol(assets, "InvType", typeof (Int32));
// SQLiteUtil.createCol(assets, "Local", typeof (Boolean)); // SQLiteUtil.createCol(assets, "Local", typeof (Boolean));
// SQLiteUtil.createCol(assets, "Temporary", typeof (Boolean)); // SQLiteUtil.createCol(assets, "Temporary", typeof (Boolean));
// SQLiteUtil.createCol(assets, "Data", typeof (Byte[])); // SQLiteUtil.createCol(assets, "Data", typeof (Byte[]));
@ -291,7 +288,6 @@ namespace OpenSim.Data.SQLite
asset.Name = (String) row["Name"]; asset.Name = (String) row["Name"];
asset.Description = (String) row["Description"]; asset.Description = (String) row["Description"];
asset.Type = Convert.ToSByte(row["Type"]); asset.Type = Convert.ToSByte(row["Type"]);
asset.InvType = Convert.ToSByte(row["InvType"]);
asset.Local = Convert.ToBoolean(row["Local"]); asset.Local = Convert.ToBoolean(row["Local"]);
asset.Temporary = Convert.ToBoolean(row["Temporary"]); asset.Temporary = Convert.ToBoolean(row["Temporary"]);
asset.Data = (byte[]) row["Data"]; asset.Data = (byte[]) row["Data"];

View File

@ -76,15 +76,6 @@ namespace OpenSim.Framework
set { _type = value; } set { _type = value; }
} }
/// <summary>
/// PLEASE DON'T USE ME. I'm probably going away soon.
/// </summary>
public virtual sbyte InvType
{
get { return _invtype; }
set { _invtype = value; }
}
public virtual string Name public virtual string Name
{ {
get { return _name; } get { return _name; }

View File

@ -701,7 +701,6 @@ namespace OpenSim.Framework.Communications.Cache
Data = aBase.Data; Data = aBase.Data;
FullID = aBase.FullID; FullID = aBase.FullID;
Type = aBase.Type; Type = aBase.Type;
InvType = aBase.InvType;
Name = aBase.Name; Name = aBase.Name;
Description = aBase.Description; Description = aBase.Description;
} }
@ -718,7 +717,6 @@ namespace OpenSim.Framework.Communications.Cache
Data = aBase.Data; Data = aBase.Data;
FullID = aBase.FullID; FullID = aBase.FullID;
Type = aBase.Type; Type = aBase.Type;
InvType = aBase.InvType;
Name = aBase.Name; Name = aBase.Name;
Description = aBase.Description; Description = aBase.Description;
} }

View File

@ -670,7 +670,6 @@ namespace OpenSim.Framework.Communications.Capabilities
asset = new AssetBase(); asset = new AssetBase();
asset.FullID = assetID; asset.FullID = assetID;
asset.Type = assType; asset.Type = assType;
asset.InvType = inType;
asset.Name = assetName; asset.Name = assetName;
asset.Data = data; asset.Data = data;
m_assetCache.AddAsset(asset); m_assetCache.AddAsset(asset);

View File

@ -216,7 +216,6 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
ourClient = remoteClient; ourClient = remoteClient;
Asset = new AssetBase(); Asset = new AssetBase();
Asset.FullID = assetID; Asset.FullID = assetID;
Asset.InvType = type;
Asset.Type = type; Asset.Type = type;
Asset.Data = data; Asset.Data = data;
Asset.Name = "blank"; Asset.Name = "blank";
@ -314,7 +313,6 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
Asset.Name = name; Asset.Name = name;
Asset.Description = description; Asset.Description = description;
Asset.Type = type; Asset.Type = type;
Asset.InvType = invType;
m_createItem = true; m_createItem = true;
if (m_finished) if (m_finished)
{ {
@ -351,7 +349,6 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
asset.FullID = LLUUID.Random(); asset.FullID = LLUUID.Random();
asset.Name = item.Name; asset.Name = item.Name;
asset.Description = item.Description; asset.Description = item.Description;
asset.InvType = (sbyte) item.InvType;
asset.Type = (sbyte) item.AssetType; asset.Type = (sbyte) item.AssetType;
item.AssetID = asset.FullID; item.AssetID = asset.FullID;