From 07609565617aa7936758acba5fd625877564a10d Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 19 Feb 2009 18:09:10 +0000 Subject: * Apply http://opensimulator.org/mantis/view.php?id=3142 * Changes varchar(36) columns to UUID type in MSSQL - this will be much more efficient * ===As always, please, please backup your database before applying this patch=== * Thanks Ruud Lathrop (for the patch) and StrawberryFride (for the review) --- OpenSim/Data/MSSQL/MSSQLAssetData.cs | 8 +- OpenSim/Data/MSSQL/MSSQLEstateData.cs | 116 +++++++++++---------- OpenSim/Data/MSSQL/MSSQLGridData.cs | 20 ++-- OpenSim/Data/MSSQL/MSSQLInventoryData.cs | 22 ++-- OpenSim/Data/MSSQL/MSSQLManager.cs | 12 ++- OpenSim/Data/MSSQL/MSSQLRegionData.cs | 105 ++++++++++--------- OpenSim/Data/MSSQL/MSSQLUserData.cs | 88 ++++++++-------- .../Data/MSSQL/Resources/003_InventoryStore.sql | 38 +++++++ OpenSim/Data/MSSQL/Resources/004_AssetStore.sql | 31 ++++++ OpenSim/Data/MSSQL/Resources/004_EstateStore.sql | 22 ++++ OpenSim/Data/MSSQL/Resources/004_GridStore.sql | 68 ++++++++++++ .../Data/MSSQL/Resources/004_InventoryStore.sql | 52 +++++++++ OpenSim/Data/MSSQL/Resources/005_EstateStore.sql | 22 ++++ OpenSim/Data/MSSQL/Resources/006_EstateStore.sql | 22 ++++ OpenSim/Data/MSSQL/Resources/006_UserStore.sql | 57 ++++++++++ OpenSim/Data/MSSQL/Resources/007_EstateStore.sql | 25 +++++ OpenSim/Data/MSSQL/Resources/007_UserStore.sql | 42 ++++++++ OpenSim/Data/MSSQL/Resources/008_EstateStore.sql | 49 +++++++++ OpenSim/Data/MSSQL/Resources/008_UserStore.sql | 29 ++++++ OpenSim/Data/MSSQL/Resources/009_EstateStore.sql | 24 +++++ OpenSim/Data/MSSQL/Resources/009_UserStore.sql | 53 ++++++++++ OpenSim/Data/MSSQL/Resources/010_UserStore.sql | 24 +++++ OpenSim/Data/MSSQL/Resources/013_RegionStore.sql | 112 ++++++++++++++++++++ OpenSim/Data/MSSQL/Resources/014_RegionStore.sql | 49 +++++++++ OpenSim/Data/MSSQL/Resources/015_RegionStore.sql | 45 ++++++++ OpenSim/Data/MSSQL/Resources/016_RegionStore.sql | 19 ++++ OpenSim/Data/MSSQL/Resources/017_RegionStore.sql | 56 ++++++++++ OpenSim/Data/MSSQL/Resources/018_RegionStore.sql | 18 ++++ OpenSim/Data/MSSQL/Resources/019_RegionStore.sql | 19 ++++ OpenSim/Data/MSSQL/Resources/020_RegionStore.sql | 58 +++++++++++ 30 files changed, 1125 insertions(+), 180 deletions(-) create mode 100644 OpenSim/Data/MSSQL/Resources/003_InventoryStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/004_AssetStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/004_EstateStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/004_GridStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/004_InventoryStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/005_EstateStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/006_EstateStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/006_UserStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/007_EstateStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/007_UserStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/008_EstateStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/008_UserStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/009_EstateStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/009_UserStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/010_UserStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/013_RegionStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/014_RegionStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/015_RegionStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/016_RegionStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/017_RegionStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/018_RegionStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/019_RegionStore.sql create mode 100644 OpenSim/Data/MSSQL/Resources/020_RegionStore.sql diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index 0361a7d..61db8f5 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs @@ -28,8 +28,8 @@ using System; using System.Data; using System.Reflection; -using log4net; using OpenMetaverse; +using log4net; using OpenSim.Framework; namespace OpenSim.Data.MSSQL @@ -71,7 +71,7 @@ namespace OpenSim.Data.MSSQL /// connect string override public void Initialise(string connectionString) { - TicksToEpoch = new DateTime(1970, 1, 1).Ticks; + TicksToEpoch = new System.DateTime(1970, 1, 1).Ticks; if (!string.IsNullOrEmpty(connectionString)) { @@ -132,7 +132,7 @@ namespace OpenSim.Data.MSSQL { AssetBase asset = new AssetBase(); // Region Main - asset.FullID = new UUID((string)reader["id"]); + asset.FullID = new UUID((Guid)reader["id"]); asset.Name = (string)reader["name"]; asset.Description = (string)reader["description"]; asset.Type = Convert.ToSByte(reader["assetType"]); @@ -162,7 +162,7 @@ namespace OpenSim.Data.MSSQL " VALUES " + "(@id, @name, @description, @assetType, @local, @temporary, @create_time, @access_time, @data)")) { - int now = (int)((DateTime.Now.Ticks - TicksToEpoch) / 10000000); + int now = (int)((System.DateTime.Now.Ticks - TicksToEpoch) / 10000000); command.Parameters.Add(database.CreateParameter("id", asset.FullID)); command.Parameters.Add(database.CreateParameter("name", asset.Name)); command.Parameters.Add(database.CreateParameter("description", asset.Description)); diff --git a/OpenSim/Data/MSSQL/MSSQLEstateData.cs b/OpenSim/Data/MSSQL/MSSQLEstateData.cs index 815e7ff..4d5c116 100644 --- a/OpenSim/Data/MSSQL/MSSQLEstateData.cs +++ b/OpenSim/Data/MSSQL/MSSQLEstateData.cs @@ -106,7 +106,7 @@ namespace OpenSim.Data.MSSQL using (AutoClosingSqlCommand cmd = _Database.Query(sql)) { - cmd.Parameters.AddWithValue("@RegionID", regionID.ToString()); + cmd.Parameters.Add(_Database.CreateParameter("@RegionID", regionID)); using (IDataReader reader = cmd.ExecuteReader()) { @@ -124,10 +124,10 @@ namespace OpenSim.Data.MSSQL } else if (_FieldMap[name].GetValue(es) is UUID) { - UUID uuid; - UUID.TryParse(reader[name].ToString(), out uuid); +// UUID uuid; +// UUID.TryParse(reader[name].ToString(), out uuid); - _FieldMap[name].SetValue(es, uuid); + _FieldMap[name].SetValue(es, new UUID((Guid) reader[name])); // uuid); } else { @@ -162,28 +162,29 @@ namespace OpenSim.Data.MSSQL foreach (string name in names) { - if (_FieldMap[name].GetValue(es) is bool) - { - SqlParameter tempBool = new SqlParameter("@" + name, SqlDbType.Bit); - - if ((bool) _FieldMap[name].GetValue(es)) - tempBool.Value = 1; - else - tempBool.Value = 0; - - insertCommand.Parameters.Add(tempBool); - } - else - { - //cmd.Parameters.AddWithValue("@" + name, _FieldMap[name].GetValue(es)); - SqlParameter tempPar = new SqlParameter("@" + name, - _Database.DbtypeFromType(_FieldMap[name].FieldType)); - tempPar.Value = _FieldMap[name].GetValue(es).ToString(); - - insertCommand.Parameters.Add(tempPar); - } + insertCommand.Parameters.Add(_Database.CreateParameter("@" + name, _FieldMap[name].GetValue(es))); +// if (_FieldMap[name].GetValue(es) is bool) +// { +// SqlParameter tempBool = new SqlParameter("@" + name, SqlDbType.Bit); +// +// if ((bool) _FieldMap[name].GetValue(es)) +// tempBool.Value = 1; +// else +// tempBool.Value = 0; +// +// insertCommand.Parameters.Add(tempBool); +// } +// else +// { +// //cmd.Parameters.AddWithValue("@" + name, _FieldMap[name].GetValue(es)); +// SqlParameter tempPar = new SqlParameter("@" + name, +// _Database.DbtypeFromType(_FieldMap[name].FieldType)); +// tempPar.Value = _FieldMap[name].GetValue(es).ToString(); +// +// insertCommand.Parameters.Add(tempPar); +// } } - +// insertCommand.Parameters.Add(_Database.CreateParameter("@ID", es.EstateID, true)); SqlParameter idParameter = new SqlParameter("@ID", SqlDbType.Int); idParameter.Direction = ParameterDirection.Output; insertCommand.Parameters.Add(idParameter); @@ -196,7 +197,7 @@ namespace OpenSim.Data.MSSQL using (AutoClosingSqlCommand cmd = _Database.Query("INSERT INTO [estate_map] ([RegionID] ,[EstateID]) VALUES (@RegionID, @EstateID)")) { - cmd.Parameters.Add(_Database.CreateParameter("@RegionID", regionID.ToString())); + cmd.Parameters.Add(_Database.CreateParameter("@RegionID", regionID)); cmd.Parameters.Add(_Database.CreateParameter("@EstateID", es.EstateID)); // This will throw on dupe key try @@ -264,32 +265,33 @@ namespace OpenSim.Data.MSSQL { foreach (string name in names) { - if (_FieldMap[name].GetValue(es) is bool) - { - SqlParameter tempBool = new SqlParameter("@" + name, SqlDbType.Bit); - - if ((bool)_FieldMap[name].GetValue(es)) - tempBool.Value = 1; - else - tempBool.Value = 0; - - cmd.Parameters.Add(tempBool); - } - else - { - //cmd.Parameters.AddWithValue("@" + name, _FieldMap[name].GetValue(es)); - SqlParameter tempPar = new SqlParameter("@" + name, - _Database.DbtypeFromType(_FieldMap[name].FieldType)); - tempPar.Value = _FieldMap[name].GetValue(es).ToString(); - - cmd.Parameters.Add(tempPar); - } + cmd.Parameters.Add(_Database.CreateParameter("@" + name, _FieldMap[name].GetValue(es))); +// if (_FieldMap[name].GetValue(es) is bool) +// { +// SqlParameter tempBool = new SqlParameter("@" + name, SqlDbType.Bit); +// +// if ((bool)_FieldMap[name].GetValue(es)) +// tempBool.Value = 1; +// else +// tempBool.Value = 0; +// +// cmd.Parameters.Add(tempBool); +// } +// else +// { +// //cmd.Parameters.AddWithValue("@" + name, _FieldMap[name].GetValue(es)); +// SqlParameter tempPar = new SqlParameter("@" + name, +// _Database.DbtypeFromType(_FieldMap[name].FieldType)); +// tempPar.Value = _FieldMap[name].GetValue(es).ToString(); +// +// cmd.Parameters.Add(tempPar); +// } } - - SqlParameter idParameter = new SqlParameter("@EstateID", SqlDbType.Int); - idParameter.Value = es.EstateID; - cmd.Parameters.Add(idParameter); + cmd.Parameters.Add(_Database.CreateParameter("@EstateID", es.EstateID)); +// SqlParameter idParameter = new SqlParameter("@EstateID", SqlDbType.Int); +// idParameter.Value = es.EstateID; +// cmd.Parameters.Add(idParameter); cmd.ExecuteNonQuery(); } @@ -327,10 +329,10 @@ namespace OpenSim.Data.MSSQL { EstateBan eb = new EstateBan(); - UUID uuid; - UUID.TryParse(reader["bannedUUID"].ToString(), out uuid); +// UUID uuid; +// UUID.TryParse(reader["bannedUUID"].ToString(), out uuid); - eb.bannedUUID = uuid; + eb.bannedUUID = new UUID((Guid)reader["bannedUUID"]); //uuid; eb.bannedIP = "0.0.0.0"; eb.bannedIPHostMask = "0.0.0.0"; es.AddBan(eb); @@ -355,10 +357,10 @@ namespace OpenSim.Data.MSSQL { // EstateBan eb = new EstateBan(); - UUID uuid; - UUID.TryParse(reader["uuid"].ToString(), out uuid); +// UUID uuid; +// UUID.TryParse(reader["uuid"].ToString(), out uuid); - uuids.Add(uuid); + uuids.Add(new UUID((Guid)reader["uuid"])); //uuid); } } } @@ -418,7 +420,7 @@ namespace OpenSim.Data.MSSQL createParamOnce = false; } else - cmd.Parameters["@uuid"].Value = uuid.ToString(); + cmd.Parameters["@uuid"].Value = uuid.Guid; //.ToString(); //TODO check if this works cmd.ExecuteNonQuery(); } diff --git a/OpenSim/Data/MSSQL/MSSQLGridData.cs b/OpenSim/Data/MSSQL/MSSQLGridData.cs index eec2091..027796a 100644 --- a/OpenSim/Data/MSSQL/MSSQLGridData.cs +++ b/OpenSim/Data/MSSQL/MSSQLGridData.cs @@ -395,17 +395,17 @@ namespace OpenSim.Data.MSSQL retval.regionHandle = tmp64; - UUID tmp_uuid; - if (!UUID.TryParse((string)reader["uuid"], out tmp_uuid)) - { - return null; - } +// UUID tmp_uuid; +// if (!UUID.TryParse((string)reader["uuid"], out tmp_uuid)) +// { +// return null; +// } - retval.UUID = tmp_uuid; + retval.UUID = new UUID((Guid)reader["uuid"]); // tmp_uuid; // non-critical parts retval.regionName = reader["regionName"].ToString(); - retval.originUUID = new UUID((string)reader["originUUID"]); + retval.originUUID = new UUID((Guid)reader["originUUID"]); // Secrets retval.regionRecvKey = reader["regionRecvKey"].ToString(); @@ -443,8 +443,10 @@ namespace OpenSim.Data.MSSQL retval.regionUserSendKey = reader["regionUserSendKey"].ToString(); // World Map Addition - UUID.TryParse((string)reader["regionMapTexture"], out retval.regionMapTextureID); - UUID.TryParse((string)reader["owner_uuid"], out retval.owner_uuid); + retval.regionMapTextureID = new UUID((Guid)reader["regionMapTexture"]); + retval.owner_uuid = new UUID((Guid)reader["owner_uuid"]); +// UUID.TryParse((string)reader["regionMapTexture"], out retval.regionMapTextureID); +// UUID.TryParse((string)reader["owner_uuid"], out retval.owner_uuid); return retval; } diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs index f367d78..4e7e322 100644 --- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs +++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs @@ -317,7 +317,7 @@ namespace OpenSim.Data.MSSQL List subFolders; using (SqlCommand command = new SqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = @parentID", connection)) { - command.Parameters.Add(database.CreateParameter("@parentID", string.Empty)); + command.Parameters.Add(database.CreateParameter("@parentID", UUID.Zero)); AutoClosingSqlCommand autoCommand = new AutoClosingSqlCommand(command); @@ -589,7 +589,7 @@ namespace OpenSim.Data.MSSQL /// private static List getFolderHierarchy(UUID parentID, AutoClosingSqlCommand command) { - command.Parameters["@parentID"].Value = parentID.ToString(); + command.Parameters["@parentID"].Value = parentID.Guid; //.ToString(); List folders = getInventoryFolders(command); @@ -663,9 +663,9 @@ namespace OpenSim.Data.MSSQL try { InventoryFolderBase folder = new InventoryFolderBase(); - folder.Owner = new UUID((string)reader["agentID"]); - folder.ParentID = new UUID((string)reader["parentFolderID"]); - folder.ID = new UUID((string)reader["folderID"]); + folder.Owner = new UUID((Guid)reader["agentID"]); + folder.ParentID = new UUID((Guid)reader["parentFolderID"]); + folder.ID = new UUID((Guid)reader["folderID"]); folder.Name = (string)reader["folderName"]; folder.Type = (short)reader["type"]; folder.Version = Convert.ToUInt16(reader["version"]); @@ -691,24 +691,24 @@ namespace OpenSim.Data.MSSQL { InventoryItemBase item = new InventoryItemBase(); - item.ID = new UUID(reader["inventoryID"].ToString()); - item.AssetID = new UUID(reader["assetID"].ToString()); + item.ID = new UUID((Guid)reader["inventoryID"]); + item.AssetID = new UUID((Guid)reader["assetID"]); item.AssetType = Convert.ToInt32(reader["assetType"].ToString()); - item.Folder = new UUID(reader["parentFolderID"].ToString()); - item.Owner = new UUID(reader["avatarID"].ToString()); + item.Folder = new UUID((Guid)reader["parentFolderID"]); + item.Owner = new UUID((Guid)reader["avatarID"]); item.Name = reader["inventoryName"].ToString(); item.Description = reader["inventoryDescription"].ToString(); item.NextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"]); item.CurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"]); item.InvType = Convert.ToInt32(reader["invType"].ToString()); - item.Creator = new UUID(reader["creatorID"].ToString()); + item.Creator = new UUID((Guid)reader["creatorID"]); item.BasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]); item.EveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]); item.GroupPermissions = Convert.ToUInt32(reader["inventoryGroupPermissions"]); item.SalePrice = Convert.ToInt32(reader["salePrice"]); item.SaleType = Convert.ToByte(reader["saleType"]); item.CreationDate = Convert.ToInt32(reader["creationDate"]); - item.GroupID = new UUID(reader["groupID"].ToString()); + item.GroupID = new UUID((Guid)reader["groupID"]); item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]); item.Flags = Convert.ToUInt32(reader["flags"]); diff --git a/OpenSim/Data/MSSQL/MSSQLManager.cs b/OpenSim/Data/MSSQL/MSSQLManager.cs index c687c89..d60c444 100644 --- a/OpenSim/Data/MSSQL/MSSQLManager.cs +++ b/OpenSim/Data/MSSQL/MSSQLManager.cs @@ -102,6 +102,7 @@ namespace OpenSim.Data.MSSQL /// /// /// +/* [Obsolete("Do not use!")] protected static string defineTable(DataTable dt) { @@ -125,6 +126,7 @@ namespace OpenSim.Data.MSSQL sql += ")"; return sql; } +*/ #endregion @@ -134,6 +136,7 @@ namespace OpenSim.Data.MSSQL /// a type /// a sqltype /// this is something we'll need to implement for each db slightly differently. +/* [Obsolete("Used by a obsolete methods")] public static string SqlType(Type type) { @@ -155,6 +158,7 @@ namespace OpenSim.Data.MSSQL } return "varchar(255)"; } +*/ /// /// Type conversion to a SQLDbType functions @@ -185,7 +189,7 @@ namespace OpenSim.Data.MSSQL } if (type == typeof(UUID)) { - return SqlDbType.VarChar; + return SqlDbType.UniqueIdentifier; } if (type == typeof(sbyte)) { @@ -215,13 +219,13 @@ namespace OpenSim.Data.MSSQL { Type valueType = value.GetType(); - if (valueType == typeof(UUID)) + if (valueType == typeof(UUID)) //TODO check if this works { - return value.ToString(); + return ((UUID) value).Guid; } if (valueType == typeof(UUID)) { - return value.ToString(); + return ((UUID)value).Guid; } if (valueType == typeof(bool)) { diff --git a/OpenSim/Data/MSSQL/MSSQLRegionData.cs b/OpenSim/Data/MSSQL/MSSQLRegionData.cs index 44b042e..d9565d4 100644 --- a/OpenSim/Data/MSSQL/MSSQLRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLRegionData.cs @@ -128,7 +128,7 @@ namespace OpenSim.Data.MSSQL sceneObjectPart.FolderID = sceneObjectPart.UUID; sceneObjectParts.Add(sceneObjectPart); - UUID groupID = new UUID(reader["SceneGroupID"].ToString()); + UUID groupID = new UUID((Guid)reader["SceneGroupID"]); if (groupID != lastGroupID) // New SOG { @@ -198,7 +198,7 @@ namespace OpenSim.Data.MSSQL } else { - command.Parameters["@PrimID"].Value = objectPart.UUID.ToString(); + command.Parameters["@PrimID"].Value = objectPart.UUID.Guid; //.ToString(); //TODO check if this works } List inventory = new List(); @@ -418,15 +418,16 @@ ELSE _Log.InfoFormat("[MSSQL]: Removing obj: {0} from region: {1}", objectID, regionUUID); //Remove from prims and primsitem table - string sqlPrims = string.Format("DELETE FROM PRIMS WHERE SceneGroupID = '{0}'", objectID); - string sqlPrimItems = string.Format("DELETE FROM PRIMITEMS WHERE primID in (SELECT UUID FROM PRIMS WHERE SceneGroupID = '{0}')", objectID); - string sqlPrimShapes = string.Format("DELETE FROM PRIMSHAPES WHERE uuid in (SELECT UUID FROM PRIMS WHERE SceneGroupID = '{0}')", objectID); + string sqlPrims = "DELETE FROM PRIMS WHERE SceneGroupID = @objectID"; + string sqlPrimItems = "DELETE FROM PRIMITEMS WHERE primID in (SELECT UUID FROM PRIMS WHERE SceneGroupID = @objectID)"; + string sqlPrimShapes = "DELETE FROM PRIMSHAPES WHERE uuid in (SELECT UUID FROM PRIMS WHERE SceneGroupID = @objectID)"; lock (_Database) { //Using the non transaction mode. using (AutoClosingSqlCommand cmd = _Database.Query(sqlPrimShapes)) { + cmd.Parameters.Add(_Database.CreateParameter("objectID", objectID)); cmd.ExecuteNonQuery(); cmd.CommandText = sqlPrimItems; @@ -495,7 +496,7 @@ ELSE using (AutoClosingSqlCommand cmd = _Database.Query(sql)) { // MySqlParameter param = new MySqlParameter(); - cmd.Parameters.AddWithValue("@RegionUUID", regionID.ToString()); + cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID)); using (SqlDataReader reader = cmd.ExecuteReader()) { @@ -805,7 +806,7 @@ VALUES //TODO change this is some more generic code so we doesnt have to change it every time a new field is added? RegionSettings newSettings = new RegionSettings(); - newSettings.RegionUUID = new UUID((string)row["regionUUID"]); + newSettings.RegionUUID = new UUID((Guid)row["regionUUID"]); newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]); newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]); newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]); @@ -819,10 +820,10 @@ VALUES newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]); newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]); newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]); - newSettings.TerrainTexture1 = new UUID((String)row["terrain_texture_1"]); - newSettings.TerrainTexture2 = new UUID((String)row["terrain_texture_2"]); - newSettings.TerrainTexture3 = new UUID((String)row["terrain_texture_3"]); - newSettings.TerrainTexture4 = new UUID((String)row["terrain_texture_4"]); + newSettings.TerrainTexture1 = new UUID((Guid)row["terrain_texture_1"]); + newSettings.TerrainTexture2 = new UUID((Guid)row["terrain_texture_2"]); + newSettings.TerrainTexture3 = new UUID((Guid)row["terrain_texture_3"]); + newSettings.TerrainTexture4 = new UUID((Guid)row["terrain_texture_4"]); newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]); newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]); newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]); @@ -843,7 +844,7 @@ VALUES Convert.ToSingle(row["sunvectory"]), Convert.ToSingle(row["sunvectorz"]) ); - newSettings.Covenant = new UUID((String)row["covenant"]); + newSettings.Covenant = new UUID((Guid)row["covenant"]); return newSettings; } @@ -857,15 +858,15 @@ VALUES { LandData newData = new LandData(); - newData.GlobalID = new UUID((String)row["UUID"]); + newData.GlobalID = new UUID((Guid)row["UUID"]); newData.LocalID = Convert.ToInt32(row["LocalLandID"]); // Bitmap is a byte[512] newData.Bitmap = (Byte[])row["Bitmap"]; - newData.Name = (String)row["Name"]; - newData.Description = (String)row["Description"]; - newData.OwnerID = (UUID)(String)row["OwnerUUID"]; + newData.Name = (string)row["Name"]; + newData.Description = (string)row["Description"]; + newData.OwnerID = new UUID((Guid)row["OwnerUUID"]); newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]); newData.Area = Convert.ToInt32(row["Area"]); newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented @@ -873,27 +874,29 @@ VALUES //Enum libsecondlife.Parcel.ParcelCategory newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]); newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]); - newData.GroupID = new UUID((String)row["GroupUUID"]); + newData.GroupID = new UUID((Guid)row["GroupUUID"]); newData.SalePrice = Convert.ToInt32(row["SalePrice"]); newData.Status = (Parcel.ParcelStatus)Convert.ToInt32(row["LandStatus"]); //Enum. libsecondlife.Parcel.ParcelStatus newData.Flags = Convert.ToUInt32(row["LandFlags"]); newData.LandingType = Convert.ToByte(row["LandingType"]); newData.MediaAutoScale = Convert.ToByte(row["MediaAutoScale"]); - newData.MediaID = new UUID((String)row["MediaTextureUUID"]); - newData.MediaURL = (String)row["MediaURL"]; - newData.MusicURL = (String)row["MusicURL"]; + newData.MediaID = new UUID((Guid)row["MediaTextureUUID"]); + newData.MediaURL = (string)row["MediaURL"]; + newData.MusicURL = (string)row["MusicURL"]; newData.PassHours = Convert.ToSingle(row["PassHours"]); newData.PassPrice = Convert.ToInt32(row["PassPrice"]); - UUID authedbuyer; - UUID snapshotID; - - if (UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer)) - newData.AuthBuyerID = authedbuyer; - - if (UUID.TryParse((string)row["SnapshotUUID"], out snapshotID)) - newData.SnapshotID = snapshotID; +// UUID authedbuyer; +// UUID snapshotID; +// +// if (UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer)) +// newData.AuthBuyerID = authedbuyer; +// +// if (UUID.TryParse((string)row["SnapshotUUID"], out snapshotID)) +// newData.SnapshotID = snapshotID; + newData.AuthBuyerID = new UUID((Guid) row["AuthBuyerID"]); + newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); newData.Dwell = Convert.ToInt32(row["Dwell"]); @@ -927,7 +930,7 @@ VALUES private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataRecord row) { ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); - entry.AgentID = new UUID((string)row["AccessUUID"]); + entry.AgentID = new UUID((Guid)row["AccessUUID"]); entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]); entry.Time = new DateTime(); return entry; @@ -942,26 +945,26 @@ VALUES { SceneObjectPart prim = new SceneObjectPart(); - prim.UUID = new UUID((String)primRow["UUID"]); + prim.UUID = new UUID((Guid)primRow["UUID"]); // explicit conversion of integers is required, which sort // of sucks. No idea if there is a shortcut here or not. prim.CreationDate = Convert.ToInt32(primRow["CreationDate"]); - prim.Name = (String)primRow["Name"]; + prim.Name = (string)primRow["Name"]; // various text fields - prim.Text = (String)primRow["Text"]; + prim.Text = (string)primRow["Text"]; prim.Color = Color.FromArgb(Convert.ToInt32(primRow["ColorA"]), Convert.ToInt32(primRow["ColorR"]), Convert.ToInt32(primRow["ColorG"]), Convert.ToInt32(primRow["ColorB"])); - prim.Description = (String)primRow["Description"]; - prim.SitName = (String)primRow["SitName"]; - prim.TouchName = (String)primRow["TouchName"]; + prim.Description = (string)primRow["Description"]; + prim.SitName = (string)primRow["SitName"]; + prim.TouchName = (string)primRow["TouchName"]; // permissions prim.ObjectFlags = Convert.ToUInt32(primRow["ObjectFlags"]); - prim.CreatorID = new UUID((String)primRow["CreatorID"]); - prim.OwnerID = new UUID((String)primRow["OwnerID"]); - prim.GroupID = new UUID((String)primRow["GroupID"]); - prim.LastOwnerID = new UUID((String)primRow["LastOwnerID"]); + prim.CreatorID = new UUID((Guid)primRow["CreatorID"]); + prim.OwnerID = new UUID((Guid)primRow["OwnerID"]); + prim.GroupID = new UUID((Guid)primRow["GroupID"]); + prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]); prim.OwnerMask = Convert.ToUInt32(primRow["OwnerMask"]); prim.NextOwnerMask = Convert.ToUInt32(primRow["NextOwnerMask"]); prim.GroupMask = Convert.ToUInt32(primRow["GroupMask"]); @@ -1017,7 +1020,7 @@ VALUES prim.PayPrice[3] = Convert.ToInt32(primRow["PayButton3"]); prim.PayPrice[4] = Convert.ToInt32(primRow["PayButton4"]); - prim.Sound = new UUID(primRow["LoopedSound"].ToString()); + prim.Sound = new UUID((Guid)primRow["LoopedSound"]); prim.SoundGain = Convert.ToSingle(primRow["LoopedSoundGain"]); prim.SoundFlags = 1; // If it's persisted at all, it's looped @@ -1062,7 +1065,7 @@ VALUES if (!(primRow["ClickAction"] is DBNull)) prim.ClickAction = Convert.ToByte(primRow["ClickAction"]); - prim.CollisionSound = new UUID(primRow["CollisionSound"].ToString()); + prim.CollisionSound = new UUID((Guid)primRow["CollisionSound"]); prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]); prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]); @@ -1131,21 +1134,21 @@ VALUES { TaskInventoryItem taskItem = new TaskInventoryItem(); - taskItem.ItemID = new UUID((String)inventoryRow["itemID"]); - taskItem.ParentPartID = new UUID((String)inventoryRow["primID"]); - taskItem.AssetID = new UUID((String)inventoryRow["assetID"]); - taskItem.ParentID = new UUID((String)inventoryRow["parentFolderID"]); + taskItem.ItemID = new UUID((Guid)inventoryRow["itemID"]); + taskItem.ParentPartID = new UUID((Guid)inventoryRow["primID"]); + taskItem.AssetID = new UUID((Guid)inventoryRow["assetID"]); + taskItem.ParentID = new UUID((Guid)inventoryRow["parentFolderID"]); taskItem.InvType = Convert.ToInt32(inventoryRow["invType"]); taskItem.Type = Convert.ToInt32(inventoryRow["assetType"]); - taskItem.Name = (String)inventoryRow["name"]; - taskItem.Description = (String)inventoryRow["description"]; + taskItem.Name = (string)inventoryRow["name"]; + taskItem.Description = (string)inventoryRow["description"]; taskItem.CreationDate = Convert.ToUInt32(inventoryRow["creationDate"]); - taskItem.CreatorID = new UUID((String)inventoryRow["creatorID"]); - taskItem.OwnerID = new UUID((String)inventoryRow["ownerID"]); - taskItem.LastOwnerID = new UUID((String)inventoryRow["lastOwnerID"]); - taskItem.GroupID = new UUID((String)inventoryRow["groupID"]); + taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]); + taskItem.OwnerID = new UUID((Guid)inventoryRow["ownerID"]); + taskItem.LastOwnerID = new UUID((Guid)inventoryRow["lastOwnerID"]); + taskItem.GroupID = new UUID((Guid)inventoryRow["groupID"]); taskItem.NextPermissions = Convert.ToUInt32(inventoryRow["nextPermissions"]); taskItem.CurrentPermissions = Convert.ToUInt32(inventoryRow["currentPermissions"]); diff --git a/OpenSim/Data/MSSQL/MSSQLUserData.cs b/OpenSim/Data/MSSQL/MSSQLUserData.cs index 453941f..e0db622 100644 --- a/OpenSim/Data/MSSQL/MSSQLUserData.cs +++ b/OpenSim/Data/MSSQL/MSSQLUserData.cs @@ -445,8 +445,8 @@ namespace OpenSim.Data.MSSQL while (reader.Read()) { FriendListItem fli = new FriendListItem(); - fli.FriendListOwner = new UUID((string)reader["ownerID"]); - fli.Friend = new UUID((string)reader["friendID"]); + fli.FriendListOwner = new UUID((Guid)reader["ownerID"]); + fli.Friend = new UUID((Guid)reader["friendID"]); fli.FriendPerms = (uint)Convert.ToInt32(reader["friendPerms"]); // This is not a real column in the database table, it's a joined column from the opposite record @@ -703,14 +703,14 @@ namespace OpenSim.Data.MSSQL { command.Parameters.Add(database.CreateParameter("@uuid", agentID)); command.Parameters.Add(database.CreateParameter("@attachpoint", attachpoint)); - command.Parameters.Add(database.CreateParameter("@item", item["item"].ToString())); - command.Parameters.Add(database.CreateParameter("@asset", item["asset"].ToString())); + command.Parameters.Add(database.CreateParameter("@item", new UUID(item["item"].ToString()))); + command.Parameters.Add(database.CreateParameter("@asset", new UUID(item["asset"].ToString()))); firstTime = false; } - command.Parameters["@uuid"].Value = agentID.ToString(); + command.Parameters["@uuid"].Value = agentID.Guid; //.ToString(); command.Parameters["@attachpoint"].Value = attachpoint; - command.Parameters["@item"].Value = item["item"].ToString(); - command.Parameters["@asset"].Value = item["asset"].ToString(); + command.Parameters["@item"].Value = new Guid(item["item"].ToString()); + command.Parameters["@asset"].Value = new Guid(item["asset"].ToString()); try { @@ -769,7 +769,7 @@ namespace OpenSim.Data.MSSQL while (reader.Read()) { AvatarPickerAvatar user = new AvatarPickerAvatar(); - user.AvatarID = new UUID((string)reader["UUID"]); + user.AvatarID = new UUID((Guid)reader["UUID"]); user.firstName = (string)reader["username"]; user.lastName = (string)reader["lastname"]; returnlist.Add(user); @@ -795,7 +795,7 @@ namespace OpenSim.Data.MSSQL while (reader.Read()) { AvatarPickerAvatar user = new AvatarPickerAvatar(); - user.AvatarID = new UUID((string)reader["UUID"]); + user.AvatarID = new UUID((Guid)reader["UUID"]); user.firstName = (string)reader["username"]; user.lastName = (string)reader["lastname"]; returnlist.Add(user); @@ -858,37 +858,37 @@ namespace OpenSim.Data.MSSQL { AvatarAppearance appearance = new AvatarAppearance(); - appearance.Owner = new UUID((string)reader["owner"]); + appearance.Owner = new UUID((Guid)reader["owner"]); appearance.Serial = Convert.ToInt32(reader["serial"]); appearance.VisualParams = (byte[])reader["visual_params"]; appearance.Texture = new Primitive.TextureEntry((byte[])reader["texture"], 0, ((byte[])reader["texture"]).Length); appearance.AvatarHeight = (float)Convert.ToDouble(reader["avatar_height"]); - appearance.BodyItem = new UUID((string)reader["body_item"]); - appearance.BodyAsset = new UUID((string)reader["body_asset"]); - appearance.SkinItem = new UUID((string)reader["skin_item"]); - appearance.SkinAsset = new UUID((string)reader["skin_asset"]); - appearance.HairItem = new UUID((string)reader["hair_item"]); - appearance.HairAsset = new UUID((string)reader["hair_asset"]); - appearance.EyesItem = new UUID((string)reader["eyes_item"]); - appearance.EyesAsset = new UUID((string)reader["eyes_asset"]); - appearance.ShirtItem = new UUID((string)reader["shirt_item"]); - appearance.ShirtAsset = new UUID((string)reader["shirt_asset"]); - appearance.PantsItem = new UUID((string)reader["pants_item"]); - appearance.PantsAsset = new UUID((string)reader["pants_asset"]); - appearance.ShoesItem = new UUID((string)reader["shoes_item"]); - appearance.ShoesAsset = new UUID((string)reader["shoes_asset"]); - appearance.SocksItem = new UUID((string)reader["socks_item"]); - appearance.SocksAsset = new UUID((string)reader["socks_asset"]); - appearance.JacketItem = new UUID((string)reader["jacket_item"]); - appearance.JacketAsset = new UUID((string)reader["jacket_asset"]); - appearance.GlovesItem = new UUID((string)reader["gloves_item"]); - appearance.GlovesAsset = new UUID((string)reader["gloves_asset"]); - appearance.UnderShirtItem = new UUID((string)reader["undershirt_item"]); - appearance.UnderShirtAsset = new UUID((string)reader["undershirt_asset"]); - appearance.UnderPantsItem = new UUID((string)reader["underpants_item"]); - appearance.UnderPantsAsset = new UUID((string)reader["underpants_asset"]); - appearance.SkirtItem = new UUID((string)reader["skirt_item"]); - appearance.SkirtAsset = new UUID((string)reader["skirt_asset"]); + appearance.BodyItem = new UUID((Guid)reader["body_item"]); + appearance.BodyAsset = new UUID((Guid)reader["body_asset"]); + appearance.SkinItem = new UUID((Guid)reader["skin_item"]); + appearance.SkinAsset = new UUID((Guid)reader["skin_asset"]); + appearance.HairItem = new UUID((Guid)reader["hair_item"]); + appearance.HairAsset = new UUID((Guid)reader["hair_asset"]); + appearance.EyesItem = new UUID((Guid)reader["eyes_item"]); + appearance.EyesAsset = new UUID((Guid)reader["eyes_asset"]); + appearance.ShirtItem = new UUID((Guid)reader["shirt_item"]); + appearance.ShirtAsset = new UUID((Guid)reader["shirt_asset"]); + appearance.PantsItem = new UUID((Guid)reader["pants_item"]); + appearance.PantsAsset = new UUID((Guid)reader["pants_asset"]); + appearance.ShoesItem = new UUID((Guid)reader["shoes_item"]); + appearance.ShoesAsset = new UUID((Guid)reader["shoes_asset"]); + appearance.SocksItem = new UUID((Guid)reader["socks_item"]); + appearance.SocksAsset = new UUID((Guid)reader["socks_asset"]); + appearance.JacketItem = new UUID((Guid)reader["jacket_item"]); + appearance.JacketAsset = new UUID((Guid)reader["jacket_asset"]); + appearance.GlovesItem = new UUID((Guid)reader["gloves_item"]); + appearance.GlovesAsset = new UUID((Guid)reader["gloves_asset"]); + appearance.UnderShirtItem = new UUID((Guid)reader["undershirt_item"]); + appearance.UnderShirtAsset = new UUID((Guid)reader["undershirt_asset"]); + appearance.UnderPantsItem = new UUID((Guid)reader["underpants_item"]); + appearance.UnderPantsAsset = new UUID((Guid)reader["underpants_asset"]); + appearance.SkirtItem = new UUID((Guid)reader["skirt_item"]); + appearance.SkirtAsset = new UUID((Guid)reader["skirt_asset"]); return appearance; } @@ -969,9 +969,9 @@ ELSE if (reader.Read()) { // Agent IDs - retval.ProfileID = new UUID((string)reader["UUID"]); - retval.SessionID = new UUID((string)reader["sessionID"]); - retval.SecureSessionID = new UUID((string)reader["secureSessionID"]); + retval.ProfileID = new UUID((Guid)reader["UUID"]); + retval.SessionID = new UUID((Guid)reader["sessionID"]); + retval.SecureSessionID = new UUID((Guid)reader["secureSessionID"]); // Agent Who? retval.AgentIP = (string)reader["agentIP"]; @@ -983,7 +983,7 @@ ELSE retval.LogoutTime = Convert.ToInt32(reader["logoutTime"].ToString()); // Current position - retval.Region = (UUID)(string)reader["currentRegion"]; + retval.Region = new UUID((Guid)reader["currentRegion"]); retval.Handle = Convert.ToUInt64(reader["currentHandle"].ToString()); Vector3 tmp_v; Vector3.TryParse((string)reader["currentPos"], out tmp_v); @@ -1110,7 +1110,7 @@ ELSE if (reader.Read()) { - retval.ID = new UUID((string)reader["UUID"]); + retval.ID = new UUID((Guid)reader["UUID"]); retval.FirstName = (string)reader["username"]; retval.SurName = (string)reader["lastname"]; @@ -1139,9 +1139,9 @@ ELSE retval.AboutText = (string)reader["profileAboutText"]; retval.FirstLifeAboutText = (string)reader["profileFirstText"]; - retval.Image = new UUID((string)reader["profileImage"]); - retval.FirstLifeImage = new UUID((string)reader["profileFirstImage"]); - retval.WebLoginKey = new UUID((string)reader["webLoginKey"]); + retval.Image = new UUID((Guid)reader["profileImage"]); + retval.FirstLifeImage = new UUID((Guid)reader["profileFirstImage"]); + retval.WebLoginKey = new UUID((Guid)reader["webLoginKey"]); } else { diff --git a/OpenSim/Data/MSSQL/Resources/003_InventoryStore.sql b/OpenSim/Data/MSSQL/Resources/003_InventoryStore.sql new file mode 100644 index 0000000..2f623ec --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/003_InventoryStore.sql @@ -0,0 +1,38 @@ +/* To prevent any potential data loss issues, you should review this script in detail before running it outside the context of the database designer.*/ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_inventoryfolders + ( + folderID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'), + agentID uniqueidentifier NULL DEFAULT (NULL), + parentFolderID uniqueidentifier NULL DEFAULT (NULL), + folderName varchar(64) NULL DEFAULT (NULL), + type smallint NOT NULL DEFAULT ((0)), + version int NOT NULL DEFAULT ((0)) + ) ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.inventoryfolders) + EXEC('INSERT INTO dbo.Tmp_inventoryfolders (folderID, agentID, parentFolderID, folderName, type, version) + SELECT CONVERT(uniqueidentifier, folderID), CONVERT(uniqueidentifier, agentID), CONVERT(uniqueidentifier, parentFolderID), folderName, type, version FROM dbo.inventoryfolders WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.inventoryfolders + +EXECUTE sp_rename N'dbo.Tmp_inventoryfolders', N'inventoryfolders', 'OBJECT' + +ALTER TABLE dbo.inventoryfolders ADD CONSTRAINT + PK__inventor__C2FABFB3173876EA PRIMARY KEY CLUSTERED + ( + folderID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +CREATE NONCLUSTERED INDEX owner ON dbo.inventoryfolders + ( + agentID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +CREATE NONCLUSTERED INDEX parent ON dbo.inventoryfolders + ( + parentFolderID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/004_AssetStore.sql b/OpenSim/Data/MSSQL/Resources/004_AssetStore.sql new file mode 100644 index 0000000..215cf3a --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/004_AssetStore.sql @@ -0,0 +1,31 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_assets + ( + id uniqueidentifier NOT NULL, + name varchar(64) NOT NULL, + description varchar(64) NOT NULL, + assetType tinyint NOT NULL, + local bit NOT NULL, + temporary bit NOT NULL, + data image NOT NULL, + create_time int NULL, + access_time int NULL + ) ON [PRIMARY] + TEXTIMAGE_ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.assets) + EXEC('INSERT INTO dbo.Tmp_assets (id, name, description, assetType, local, temporary, data, create_time, access_time) + SELECT CONVERT(uniqueidentifier, id), name, description, assetType, local, temporary, data, create_time, access_time FROM dbo.assets WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE assets + +EXECUTE sp_rename N'Tmp_assets', N'assets', 'OBJECT' + +ALTER TABLE dbo.assets ADD CONSTRAINT + PK__assets__id PRIMARY KEY CLUSTERED + ( + id + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/004_EstateStore.sql b/OpenSim/Data/MSSQL/Resources/004_EstateStore.sql new file mode 100644 index 0000000..0a132c1 --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/004_EstateStore.sql @@ -0,0 +1,22 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_estate_managers + ( + EstateID int NOT NULL, + uuid uniqueidentifier NOT NULL + ) ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.estate_managers) + EXEC('INSERT INTO dbo.Tmp_estate_managers (EstateID, uuid) + SELECT EstateID, CONVERT(uniqueidentifier, uuid) FROM dbo.estate_managers WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.estate_managers + +EXECUTE sp_rename N'dbo.Tmp_estate_managers', N'estate_managers', 'OBJECT' + +CREATE NONCLUSTERED INDEX IX_estate_managers ON dbo.estate_managers + ( + EstateID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/004_GridStore.sql b/OpenSim/Data/MSSQL/Resources/004_GridStore.sql new file mode 100644 index 0000000..6456c95 --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/004_GridStore.sql @@ -0,0 +1,68 @@ +/* To prevent any potential data loss issues, you should review this script in detail before running it outside the context of the database designer.*/ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_regions + ( + uuid uniqueidentifier NOT NULL, + regionHandle bigint NULL, + regionName varchar(20) NULL, + regionRecvKey varchar(128) NULL, + regionSendKey varchar(128) NULL, + regionSecret varchar(128) NULL, + regionDataURI varchar(128) NULL, + serverIP varchar(64) NULL, + serverPort int NULL, + serverURI varchar(255) NULL, + locX int NULL, + locY int NULL, + locZ int NULL, + eastOverrideHandle bigint NULL, + westOverrideHandle bigint NULL, + southOverrideHandle bigint NULL, + northOverrideHandle bigint NULL, + regionAssetURI varchar(255) NULL, + regionAssetRecvKey varchar(128) NULL, + regionAssetSendKey varchar(128) NULL, + regionUserURI varchar(255) NULL, + regionUserRecvKey varchar(128) NULL, + regionUserSendKey varchar(128) NULL, + regionMapTexture uniqueidentifier NULL, + serverHttpPort int NULL, + serverRemotingPort int NULL, + owner_uuid uniqueidentifier NOT NULL, + originUUID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000') + ) ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.regions) + EXEC('INSERT INTO dbo.Tmp_regions (uuid, regionHandle, regionName, regionRecvKey, regionSendKey, regionSecret, regionDataURI, serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort, owner_uuid, originUUID) + SELECT CONVERT(uniqueidentifier, uuid), regionHandle, regionName, regionRecvKey, regionSendKey, regionSecret, regionDataURI, serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, CONVERT(uniqueidentifier, regionMapTexture), serverHttpPort, serverRemotingPort, CONVERT(uniqueidentifier, owner_uuid), CONVERT(uniqueidentifier, originUUID) FROM dbo.regions WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.regions + +EXECUTE sp_rename N'dbo.Tmp_regions', N'regions', 'OBJECT' + +ALTER TABLE dbo.regions ADD CONSTRAINT + PK__regions__uuid PRIMARY KEY CLUSTERED + ( + uuid + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +CREATE NONCLUSTERED INDEX IX_regions_name ON dbo.regions + ( + regionName + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +CREATE NONCLUSTERED INDEX IX_regions_handle ON dbo.regions + ( + regionHandle + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +CREATE NONCLUSTERED INDEX IX_regions_override ON dbo.regions + ( + eastOverrideHandle, + westOverrideHandle, + southOverrideHandle, + northOverrideHandle + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/004_InventoryStore.sql b/OpenSim/Data/MSSQL/Resources/004_InventoryStore.sql new file mode 100644 index 0000000..96ef1c0 --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/004_InventoryStore.sql @@ -0,0 +1,52 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_inventoryitems + ( + inventoryID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'), + assetID uniqueidentifier NULL DEFAULT (NULL), + assetType int NULL DEFAULT (NULL), + parentFolderID uniqueidentifier NULL DEFAULT (NULL), + avatarID uniqueidentifier NULL DEFAULT (NULL), + inventoryName varchar(64) NULL DEFAULT (NULL), + inventoryDescription varchar(128) NULL DEFAULT (NULL), + inventoryNextPermissions int NULL DEFAULT (NULL), + inventoryCurrentPermissions int NULL DEFAULT (NULL), + invType int NULL DEFAULT (NULL), + creatorID uniqueidentifier NULL DEFAULT (NULL), + inventoryBasePermissions int NOT NULL DEFAULT ((0)), + inventoryEveryOnePermissions int NOT NULL DEFAULT ((0)), + salePrice int NULL DEFAULT (NULL), + saleType tinyint NULL DEFAULT (NULL), + creationDate int NULL DEFAULT (NULL), + groupID uniqueidentifier NULL DEFAULT (NULL), + groupOwned bit NULL DEFAULT (NULL), + flags int NULL DEFAULT (NULL), + inventoryGroupPermissions int NOT NULL DEFAULT ((0)) + ) ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.inventoryitems) + EXEC('INSERT INTO dbo.Tmp_inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, groupID, groupOwned, flags, inventoryGroupPermissions) + SELECT CONVERT(uniqueidentifier, inventoryID), CONVERT(uniqueidentifier, assetID), assetType, CONVERT(uniqueidentifier, parentFolderID), CONVERT(uniqueidentifier, avatarID), inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, CONVERT(uniqueidentifier, creatorID), inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, CONVERT(uniqueidentifier, groupID), groupOwned, flags, inventoryGroupPermissions FROM dbo.inventoryitems WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.inventoryitems + +EXECUTE sp_rename N'dbo.Tmp_inventoryitems', N'inventoryitems', 'OBJECT' + +ALTER TABLE dbo.inventoryitems ADD CONSTRAINT + PK__inventor__C4B7BC2220C1E124 PRIMARY KEY CLUSTERED + ( + inventoryID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + + +CREATE NONCLUSTERED INDEX owner ON dbo.inventoryitems + ( + avatarID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +CREATE NONCLUSTERED INDEX folder ON dbo.inventoryitems + ( + parentFolderID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/005_EstateStore.sql b/OpenSim/Data/MSSQL/Resources/005_EstateStore.sql new file mode 100644 index 0000000..ba93b39 --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/005_EstateStore.sql @@ -0,0 +1,22 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_estate_groups + ( + EstateID int NOT NULL, + uuid uniqueidentifier NOT NULL + ) ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.estate_groups) + EXEC('INSERT INTO dbo.Tmp_estate_groups (EstateID, uuid) + SELECT EstateID, CONVERT(uniqueidentifier, uuid) FROM dbo.estate_groups WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.estate_groups + +EXECUTE sp_rename N'dbo.Tmp_estate_groups', N'estate_groups', 'OBJECT' + +CREATE NONCLUSTERED INDEX IX_estate_groups ON dbo.estate_groups + ( + EstateID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/006_EstateStore.sql b/OpenSim/Data/MSSQL/Resources/006_EstateStore.sql new file mode 100644 index 0000000..f7df8fd --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/006_EstateStore.sql @@ -0,0 +1,22 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_estate_users + ( + EstateID int NOT NULL, + uuid uniqueidentifier NOT NULL + ) ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.estate_users) + EXEC('INSERT INTO dbo.Tmp_estate_users (EstateID, uuid) + SELECT EstateID, CONVERT(uniqueidentifier, uuid) FROM dbo.estate_users WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.estate_users + +EXECUTE sp_rename N'dbo.Tmp_estate_users', N'estate_users', 'OBJECT' + +CREATE NONCLUSTERED INDEX IX_estate_users ON dbo.estate_users + ( + EstateID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/006_UserStore.sql b/OpenSim/Data/MSSQL/Resources/006_UserStore.sql new file mode 100644 index 0000000..67fe581 --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/006_UserStore.sql @@ -0,0 +1,57 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_users + ( + UUID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'), + username varchar(32) NOT NULL, + lastname varchar(32) NOT NULL, + passwordHash varchar(32) NOT NULL, + passwordSalt varchar(32) NOT NULL, + homeRegion bigint NULL DEFAULT (NULL), + homeLocationX float(53) NULL DEFAULT (NULL), + homeLocationY float(53) NULL DEFAULT (NULL), + homeLocationZ float(53) NULL DEFAULT (NULL), + homeLookAtX float(53) NULL DEFAULT (NULL), + homeLookAtY float(53) NULL DEFAULT (NULL), + homeLookAtZ float(53) NULL DEFAULT (NULL), + created int NOT NULL, + lastLogin int NOT NULL, + userInventoryURI varchar(255) NULL DEFAULT (NULL), + userAssetURI varchar(255) NULL DEFAULT (NULL), + profileCanDoMask int NULL DEFAULT (NULL), + profileWantDoMask int NULL DEFAULT (NULL), + profileAboutText ntext NULL, + profileFirstText ntext NULL, + profileImage uniqueidentifier NULL DEFAULT (NULL), + profileFirstImage uniqueidentifier NULL DEFAULT (NULL), + webLoginKey uniqueidentifier NULL DEFAULT (NULL), + homeRegionID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'), + userFlags int NOT NULL DEFAULT ((0)), + godLevel int NOT NULL DEFAULT ((0)), + customType varchar(32) NOT NULL DEFAULT (''), + partner uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'), + email varchar(250) NULL + ) ON [PRIMARY] + TEXTIMAGE_ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.users) + EXEC('INSERT INTO dbo.Tmp_users (UUID, username, lastname, passwordHash, passwordSalt, homeRegion, homeLocationX, homeLocationY, homeLocationZ, homeLookAtX, homeLookAtY, homeLookAtZ, created, lastLogin, userInventoryURI, userAssetURI, profileCanDoMask, profileWantDoMask, profileAboutText, profileFirstText, profileImage, profileFirstImage, webLoginKey, homeRegionID, userFlags, godLevel, customType, partner, email) + SELECT CONVERT(uniqueidentifier, UUID), username, lastname, passwordHash, passwordSalt, homeRegion, homeLocationX, homeLocationY, homeLocationZ, homeLookAtX, homeLookAtY, homeLookAtZ, created, lastLogin, userInventoryURI, userAssetURI, profileCanDoMask, profileWantDoMask, profileAboutText, profileFirstText, CONVERT(uniqueidentifier, profileImage), CONVERT(uniqueidentifier, profileFirstImage), CONVERT(uniqueidentifier, webLoginKey), CONVERT(uniqueidentifier, homeRegionID), userFlags, godLevel, customType, CONVERT(uniqueidentifier, partner), email FROM dbo.users WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.users + +EXECUTE sp_rename N'dbo.Tmp_users', N'users', 'OBJECT' + +ALTER TABLE dbo.users ADD CONSTRAINT + PK__users__65A475E737A5467C PRIMARY KEY CLUSTERED + ( + UUID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +CREATE NONCLUSTERED INDEX usernames ON dbo.users + ( + username, + lastname + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/007_EstateStore.sql b/OpenSim/Data/MSSQL/Resources/007_EstateStore.sql new file mode 100644 index 0000000..c9165b0 --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/007_EstateStore.sql @@ -0,0 +1,25 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_estateban + ( + EstateID int NOT NULL, + bannedUUID uniqueidentifier NOT NULL, + bannedIp varchar(16) NULL, + bannedIpHostMask varchar(16) NULL, + bannedNameMask varchar(64) NULL + ) ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.estateban) + EXEC('INSERT INTO dbo.Tmp_estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask) + SELECT EstateID, CONVERT(uniqueidentifier, bannedUUID), bannedIp, bannedIpHostMask, bannedNameMask FROM dbo.estateban WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.estateban + +EXECUTE sp_rename N'dbo.Tmp_estateban', N'estateban', 'OBJECT' + +CREATE NONCLUSTERED INDEX IX_estateban ON dbo.estateban + ( + EstateID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/007_UserStore.sql b/OpenSim/Data/MSSQL/Resources/007_UserStore.sql new file mode 100644 index 0000000..92a8fc5 --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/007_UserStore.sql @@ -0,0 +1,42 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_agents + ( + UUID uniqueidentifier NOT NULL, + sessionID uniqueidentifier NOT NULL, + secureSessionID uniqueidentifier NOT NULL, + agentIP varchar(16) NOT NULL, + agentPort int NOT NULL, + agentOnline tinyint NOT NULL, + loginTime int NOT NULL, + logoutTime int NOT NULL, + currentRegion uniqueidentifier NOT NULL, + currentHandle bigint NOT NULL, + currentPos varchar(64) NOT NULL + ) ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.agents) + EXEC('INSERT INTO dbo.Tmp_agents (UUID, sessionID, secureSessionID, agentIP, agentPort, agentOnline, loginTime, logoutTime, currentRegion, currentHandle, currentPos) + SELECT CONVERT(uniqueidentifier, UUID), CONVERT(uniqueidentifier, sessionID), CONVERT(uniqueidentifier, secureSessionID), agentIP, agentPort, agentOnline, loginTime, logoutTime, CONVERT(uniqueidentifier, currentRegion), currentHandle, currentPos FROM dbo.agents WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.agents + +EXECUTE sp_rename N'dbo.Tmp_agents', N'agents', 'OBJECT' + +ALTER TABLE dbo.agents ADD CONSTRAINT + PK__agents__65A475E749C3F6B7 PRIMARY KEY CLUSTERED + ( + UUID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +CREATE NONCLUSTERED INDEX session ON dbo.agents + ( + sessionID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +CREATE NONCLUSTERED INDEX ssession ON dbo.agents + ( + secureSessionID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/008_EstateStore.sql b/OpenSim/Data/MSSQL/Resources/008_EstateStore.sql new file mode 100644 index 0000000..9c5355e --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/008_EstateStore.sql @@ -0,0 +1,49 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_estate_settings + ( + EstateID int NOT NULL IDENTITY (1, 100), + EstateName varchar(64) NULL DEFAULT (NULL), + AbuseEmailToEstateOwner bit NOT NULL, + DenyAnonymous bit NOT NULL, + ResetHomeOnTeleport bit NOT NULL, + FixedSun bit NOT NULL, + DenyTransacted bit NOT NULL, + BlockDwell bit NOT NULL, + DenyIdentified bit NOT NULL, + AllowVoice bit NOT NULL, + UseGlobalTime bit NOT NULL, + PricePerMeter int NOT NULL, + TaxFree bit NOT NULL, + AllowDirectTeleport bit NOT NULL, + RedirectGridX int NOT NULL, + RedirectGridY int NOT NULL, + ParentEstateID int NOT NULL, + SunPosition float(53) NOT NULL, + EstateSkipScripts bit NOT NULL, + BillableFactor float(53) NOT NULL, + PublicAccess bit NOT NULL, + AbuseEmail varchar(255) NOT NULL, + EstateOwner uniqueidentifier NOT NULL, + DenyMinors bit NOT NULL + ) ON [PRIMARY] + +SET IDENTITY_INSERT dbo.Tmp_estate_settings ON + +IF EXISTS(SELECT * FROM dbo.estate_settings) + EXEC('INSERT INTO dbo.Tmp_estate_settings (EstateID, EstateName, AbuseEmailToEstateOwner, DenyAnonymous, ResetHomeOnTeleport, FixedSun, DenyTransacted, BlockDwell, DenyIdentified, AllowVoice, UseGlobalTime, PricePerMeter, TaxFree, AllowDirectTeleport, RedirectGridX, RedirectGridY, ParentEstateID, SunPosition, EstateSkipScripts, BillableFactor, PublicAccess, AbuseEmail, EstateOwner, DenyMinors) + SELECT EstateID, EstateName, AbuseEmailToEstateOwner, DenyAnonymous, ResetHomeOnTeleport, FixedSun, DenyTransacted, BlockDwell, DenyIdentified, AllowVoice, UseGlobalTime, PricePerMeter, TaxFree, AllowDirectTeleport, RedirectGridX, RedirectGridY, ParentEstateID, SunPosition, EstateSkipScripts, BillableFactor, PublicAccess, AbuseEmail, CONVERT(uniqueidentifier, EstateOwner), DenyMinors FROM dbo.estate_settings WITH (HOLDLOCK TABLOCKX)') + +SET IDENTITY_INSERT dbo.Tmp_estate_settings OFF + +DROP TABLE dbo.estate_settings + +EXECUTE sp_rename N'dbo.Tmp_estate_settings', N'estate_settings', 'OBJECT' + +ALTER TABLE dbo.estate_settings ADD CONSTRAINT + PK_estate_settings PRIMARY KEY CLUSTERED + ( + EstateID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/008_UserStore.sql b/OpenSim/Data/MSSQL/Resources/008_UserStore.sql new file mode 100644 index 0000000..505252b --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/008_UserStore.sql @@ -0,0 +1,29 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_userfriends + ( + ownerID uniqueidentifier NOT NULL, + friendID uniqueidentifier NOT NULL, + friendPerms int NOT NULL, + datetimestamp int NOT NULL + ) ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.userfriends) + EXEC('INSERT INTO dbo.Tmp_userfriends (ownerID, friendID, friendPerms, datetimestamp) + SELECT CONVERT(uniqueidentifier, ownerID), CONVERT(uniqueidentifier, friendID), friendPerms, datetimestamp FROM dbo.userfriends WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.userfriends + +EXECUTE sp_rename N'dbo.Tmp_userfriends', N'userfriends', 'OBJECT' + +CREATE NONCLUSTERED INDEX IX_userfriends_ownerID ON dbo.userfriends + ( + ownerID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +CREATE NONCLUSTERED INDEX IX_userfriends_friendID ON dbo.userfriends + ( + friendID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/009_EstateStore.sql b/OpenSim/Data/MSSQL/Resources/009_EstateStore.sql new file mode 100644 index 0000000..f91557c --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/009_EstateStore.sql @@ -0,0 +1,24 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_estate_map + ( + RegionID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'), + EstateID int NOT NULL + ) ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.estate_map) + EXEC('INSERT INTO dbo.Tmp_estate_map (RegionID, EstateID) + SELECT CONVERT(uniqueidentifier, RegionID), EstateID FROM dbo.estate_map WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.estate_map + +EXECUTE sp_rename N'dbo.Tmp_estate_map', N'estate_map', 'OBJECT' + +ALTER TABLE dbo.estate_map ADD CONSTRAINT + PK_estate_map PRIMARY KEY CLUSTERED + ( + RegionID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/009_UserStore.sql b/OpenSim/Data/MSSQL/Resources/009_UserStore.sql new file mode 100644 index 0000000..b1ab8ba --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/009_UserStore.sql @@ -0,0 +1,53 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_avatarappearance + ( + Owner uniqueidentifier NOT NULL, + Serial int NOT NULL, + Visual_Params image NOT NULL, + Texture image NOT NULL, + Avatar_Height float(53) NOT NULL, + Body_Item uniqueidentifier NOT NULL, + Body_Asset uniqueidentifier NOT NULL, + Skin_Item uniqueidentifier NOT NULL, + Skin_Asset uniqueidentifier NOT NULL, + Hair_Item uniqueidentifier NOT NULL, + Hair_Asset uniqueidentifier NOT NULL, + Eyes_Item uniqueidentifier NOT NULL, + Eyes_Asset uniqueidentifier NOT NULL, + Shirt_Item uniqueidentifier NOT NULL, + Shirt_Asset uniqueidentifier NOT NULL, + Pants_Item uniqueidentifier NOT NULL, + Pants_Asset uniqueidentifier NOT NULL, + Shoes_Item uniqueidentifier NOT NULL, + Shoes_Asset uniqueidentifier NOT NULL, + Socks_Item uniqueidentifier NOT NULL, + Socks_Asset uniqueidentifier NOT NULL, + Jacket_Item uniqueidentifier NOT NULL, + Jacket_Asset uniqueidentifier NOT NULL, + Gloves_Item uniqueidentifier NOT NULL, + Gloves_Asset uniqueidentifier NOT NULL, + Undershirt_Item uniqueidentifier NOT NULL, + Undershirt_Asset uniqueidentifier NOT NULL, + Underpants_Item uniqueidentifier NOT NULL, + Underpants_Asset uniqueidentifier NOT NULL, + Skirt_Item uniqueidentifier NOT NULL, + Skirt_Asset uniqueidentifier NOT NULL + ) ON [PRIMARY] + TEXTIMAGE_ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.avatarappearance) + EXEC('INSERT INTO dbo.Tmp_avatarappearance (Owner, Serial, Visual_Params, Texture, Avatar_Height, Body_Item, Body_Asset, Skin_Item, Skin_Asset, Hair_Item, Hair_Asset, Eyes_Item, Eyes_Asset, Shirt_Item, Shirt_Asset, Pants_Item, Pants_Asset, Shoes_Item, Shoes_Asset, Socks_Item, Socks_Asset, Jacket_Item, Jacket_Asset, Gloves_Item, Gloves_Asset, Undershirt_Item, Undershirt_Asset, Underpants_Item, Underpants_Asset, Skirt_Item, Skirt_Asset) + SELECT CONVERT(uniqueidentifier, Owner), Serial, Visual_Params, Texture, Avatar_Height, CONVERT(uniqueidentifier, Body_Item), CONVERT(uniqueidentifier, Body_Asset), CONVERT(uniqueidentifier, Skin_Item), CONVERT(uniqueidentifier, Skin_Asset), CONVERT(uniqueidentifier, Hair_Item), CONVERT(uniqueidentifier, Hair_Asset), CONVERT(uniqueidentifier, Eyes_Item), CONVERT(uniqueidentifier, Eyes_Asset), CONVERT(uniqueidentifier, Shirt_Item), CONVERT(uniqueidentifier, Shirt_Asset), CONVERT(uniqueidentifier, Pants_Item), CONVERT(uniqueidentifier, Pants_Asset), CONVERT(uniqueidentifier, Shoes_Item), CONVERT(uniqueidentifier, Shoes_Asset), CONVERT(uniqueidentifier, Socks_Item), CONVERT(uniqueidentifier, Socks_Asset), CONVERT(uniqueidentifier, Jacket_Item), CONVERT(uniqueidentifier, Jacket_Asset), CONVERT(uniqueidentifier, Gloves_Item), CONVERT(uniqueidentifier, Gloves_Asset), CONVERT(uniqueidentifier, Undershirt_Item), CONVERT(uniqueidentifier, Undershirt_Asset), CONVERT(uniqueidentifier, Underpants_Item), CONVERT(uniqueidentifier, Underpants_Asset), CONVERT(uniqueidentifier, Skirt_Item), CONVERT(uniqueidentifier, Skirt_Asset) FROM dbo.avatarappearance WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.avatarappearance + +EXECUTE sp_rename N'dbo.Tmp_avatarappearance', N'avatarappearance', 'OBJECT' + +ALTER TABLE dbo.avatarappearance ADD CONSTRAINT + PK__avatarap__7DD115CC4E88ABD4 PRIMARY KEY CLUSTERED + ( + Owner + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/010_UserStore.sql b/OpenSim/Data/MSSQL/Resources/010_UserStore.sql new file mode 100644 index 0000000..0af008a --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/010_UserStore.sql @@ -0,0 +1,24 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_avatarattachments + ( + UUID uniqueidentifier NOT NULL, + attachpoint int NOT NULL, + item uniqueidentifier NOT NULL, + asset uniqueidentifier NOT NULL + ) ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.avatarattachments) + EXEC('INSERT INTO dbo.Tmp_avatarattachments (UUID, attachpoint, item, asset) + SELECT CONVERT(uniqueidentifier, UUID), attachpoint, CONVERT(uniqueidentifier, item), CONVERT(uniqueidentifier, asset) FROM dbo.avatarattachments WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.avatarattachments + +EXECUTE sp_rename N'dbo.Tmp_avatarattachments', N'avatarattachments', 'OBJECT' + +CREATE NONCLUSTERED INDEX IX_avatarattachments ON dbo.avatarattachments + ( + UUID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/013_RegionStore.sql b/OpenSim/Data/MSSQL/Resources/013_RegionStore.sql new file mode 100644 index 0000000..ef5d4c0 --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/013_RegionStore.sql @@ -0,0 +1,112 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_prims + ( + UUID uniqueidentifier NOT NULL, + RegionUUID uniqueidentifier NULL, + ParentID int NULL, + CreationDate int NULL, + Name varchar(255) NULL, + SceneGroupID uniqueidentifier NULL, + Text varchar(255) NULL, + Description varchar(255) NULL, + SitName varchar(255) NULL, + TouchName varchar(255) NULL, + ObjectFlags int NULL, + CreatorID uniqueidentifier NULL, + OwnerID uniqueidentifier NULL, + GroupID uniqueidentifier NULL, + LastOwnerID uniqueidentifier NULL, + OwnerMask int NULL, + NextOwnerMask int NULL, + GroupMask int NULL, + EveryoneMask int NULL, + BaseMask int NULL, + PositionX float(53) NULL, + PositionY float(53) NULL, + PositionZ float(53) NULL, + GroupPositionX float(53) NULL, + GroupPositionY float(53) NULL, + GroupPositionZ float(53) NULL, + VelocityX float(53) NULL, + VelocityY float(53) NULL, + VelocityZ float(53) NULL, + AngularVelocityX float(53) NULL, + AngularVelocityY float(53) NULL, + AngularVelocityZ float(53) NULL, + AccelerationX float(53) NULL, + AccelerationY float(53) NULL, + AccelerationZ float(53) NULL, + RotationX float(53) NULL, + RotationY float(53) NULL, + RotationZ float(53) NULL, + RotationW float(53) NULL, + SitTargetOffsetX float(53) NULL, + SitTargetOffsetY float(53) NULL, + SitTargetOffsetZ float(53) NULL, + SitTargetOrientW float(53) NULL, + SitTargetOrientX float(53) NULL, + SitTargetOrientY float(53) NULL, + SitTargetOrientZ float(53) NULL, + PayPrice int NOT NULL DEFAULT ((0)), + PayButton1 int NOT NULL DEFAULT ((0)), + PayButton2 int NOT NULL DEFAULT ((0)), + PayButton3 int NOT NULL DEFAULT ((0)), + PayButton4 int NOT NULL DEFAULT ((0)), + LoopedSound uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'), + LoopedSoundGain float(53) NOT NULL DEFAULT ((0.0)), + TextureAnimation image NULL, + OmegaX float(53) NOT NULL DEFAULT ((0.0)), + OmegaY float(53) NOT NULL DEFAULT ((0.0)), + OmegaZ float(53) NOT NULL DEFAULT ((0.0)), + CameraEyeOffsetX float(53) NOT NULL DEFAULT ((0.0)), + CameraEyeOffsetY float(53) NOT NULL DEFAULT ((0.0)), + CameraEyeOffsetZ float(53) NOT NULL DEFAULT ((0.0)), + CameraAtOffsetX float(53) NOT NULL DEFAULT ((0.0)), + CameraAtOffsetY float(53) NOT NULL DEFAULT ((0.0)), + CameraAtOffsetZ float(53) NOT NULL DEFAULT ((0.0)), + ForceMouselook tinyint NOT NULL DEFAULT ((0)), + ScriptAccessPin int NOT NULL DEFAULT ((0)), + AllowedDrop tinyint NOT NULL DEFAULT ((0)), + DieAtEdge tinyint NOT NULL DEFAULT ((0)), + SalePrice int NOT NULL DEFAULT ((10)), + SaleType tinyint NOT NULL DEFAULT ((0)), + ColorR int NOT NULL DEFAULT ((0)), + ColorG int NOT NULL DEFAULT ((0)), + ColorB int NOT NULL DEFAULT ((0)), + ColorA int NOT NULL DEFAULT ((0)), + ParticleSystem image NULL, + ClickAction tinyint NOT NULL DEFAULT ((0)), + Material tinyint NOT NULL DEFAULT ((3)), + CollisionSound uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'), + CollisionSoundVolume float(53) NOT NULL DEFAULT ((0.0)), + LinkNumber int NOT NULL DEFAULT ((0)) + ) ON [PRIMARY] + TEXTIMAGE_ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.prims) + EXEC('INSERT INTO dbo.Tmp_prims (UUID, RegionUUID, ParentID, CreationDate, Name, SceneGroupID, Text, Description, SitName, TouchName, ObjectFlags, CreatorID, OwnerID, GroupID, LastOwnerID, OwnerMask, NextOwnerMask, GroupMask, EveryoneMask, BaseMask, PositionX, PositionY, PositionZ, GroupPositionX, GroupPositionY, GroupPositionZ, VelocityX, VelocityY, VelocityZ, AngularVelocityX, AngularVelocityY, AngularVelocityZ, AccelerationX, AccelerationY, AccelerationZ, RotationX, RotationY, RotationZ, RotationW, SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ, SitTargetOrientW, SitTargetOrientX, SitTargetOrientY, SitTargetOrientZ, PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, LoopedSound, LoopedSoundGain, TextureAnimation, OmegaX, OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ, ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA, ParticleSystem, ClickAction, Material, CollisionSound, CollisionSoundVolume, LinkNumber) + SELECT CONVERT(uniqueidentifier, UUID), CONVERT(uniqueidentifier, RegionUUID), ParentID, CreationDate, Name, CONVERT(uniqueidentifier, SceneGroupID), Text, Description, SitName, TouchName, ObjectFlags, CONVERT(uniqueidentifier, CreatorID), CONVERT(uniqueidentifier, OwnerID), CONVERT(uniqueidentifier, GroupID), CONVERT(uniqueidentifier, LastOwnerID), OwnerMask, NextOwnerMask, GroupMask, EveryoneMask, BaseMask, PositionX, PositionY, PositionZ, GroupPositionX, GroupPositionY, GroupPositionZ, VelocityX, VelocityY, VelocityZ, AngularVelocityX, AngularVelocityY, AngularVelocityZ, AccelerationX, AccelerationY, AccelerationZ, RotationX, RotationY, RotationZ, RotationW, SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ, SitTargetOrientW, SitTargetOrientX, SitTargetOrientY, SitTargetOrientZ, PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, CONVERT(uniqueidentifier, LoopedSound), LoopedSoundGain, TextureAnimation, OmegaX, OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ, ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA, ParticleSystem, ClickAction, Material, CONVERT(uniqueidentifier, CollisionSound), CollisionSoundVolume, LinkNumber FROM dbo.prims WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.prims + +EXECUTE sp_rename N'dbo.Tmp_prims', N'prims', 'OBJECT' + +ALTER TABLE dbo.prims ADD CONSTRAINT + PK__prims__10566F31 PRIMARY KEY CLUSTERED + ( + UUID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + + +CREATE NONCLUSTERED INDEX prims_regionuuid ON dbo.prims + ( + RegionUUID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +CREATE NONCLUSTERED INDEX prims_parentid ON dbo.prims + ( + ParentID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/014_RegionStore.sql b/OpenSim/Data/MSSQL/Resources/014_RegionStore.sql new file mode 100644 index 0000000..02f6f55 --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/014_RegionStore.sql @@ -0,0 +1,49 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_primshapes + ( + UUID uniqueidentifier NOT NULL, + Shape int NULL, + ScaleX float(53) NULL, + ScaleY float(53) NULL, + ScaleZ float(53) NULL, + PCode int NULL, + PathBegin int NULL, + PathEnd int NULL, + PathScaleX int NULL, + PathScaleY int NULL, + PathShearX int NULL, + PathShearY int NULL, + PathSkew int NULL, + PathCurve int NULL, + PathRadiusOffset int NULL, + PathRevolutions int NULL, + PathTaperX int NULL, + PathTaperY int NULL, + PathTwist int NULL, + PathTwistBegin int NULL, + ProfileBegin int NULL, + ProfileEnd int NULL, + ProfileCurve int NULL, + ProfileHollow int NULL, + State int NULL, + Texture image NULL, + ExtraParams image NULL + ) ON [PRIMARY] + TEXTIMAGE_ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.primshapes) + EXEC('INSERT INTO dbo.Tmp_primshapes (UUID, Shape, ScaleX, ScaleY, ScaleZ, PCode, PathBegin, PathEnd, PathScaleX, PathScaleY, PathShearX, PathShearY, PathSkew, PathCurve, PathRadiusOffset, PathRevolutions, PathTaperX, PathTaperY, PathTwist, PathTwistBegin, ProfileBegin, ProfileEnd, ProfileCurve, ProfileHollow, State, Texture, ExtraParams) + SELECT CONVERT(uniqueidentifier, UUID), Shape, ScaleX, ScaleY, ScaleZ, PCode, PathBegin, PathEnd, PathScaleX, PathScaleY, PathShearX, PathShearY, PathSkew, PathCurve, PathRadiusOffset, PathRevolutions, PathTaperX, PathTaperY, PathTwist, PathTwistBegin, ProfileBegin, ProfileEnd, ProfileCurve, ProfileHollow, State, Texture, ExtraParams FROM dbo.primshapes WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.primshapes + +EXECUTE sp_rename N'dbo.Tmp_primshapes', N'primshapes', 'OBJECT' + +ALTER TABLE dbo.primshapes ADD CONSTRAINT + PK__primshapes__0880433F PRIMARY KEY CLUSTERED + ( + UUID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/015_RegionStore.sql b/OpenSim/Data/MSSQL/Resources/015_RegionStore.sql new file mode 100644 index 0000000..cbaaf88 --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/015_RegionStore.sql @@ -0,0 +1,45 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_primitems + ( + itemID uniqueidentifier NOT NULL, + primID uniqueidentifier NULL, + assetID uniqueidentifier NULL, + parentFolderID uniqueidentifier NULL, + invType int NULL, + assetType int NULL, + name varchar(255) NULL, + description varchar(255) NULL, + creationDate varchar(255) NULL, + creatorID uniqueidentifier NULL, + ownerID uniqueidentifier NULL, + lastOwnerID uniqueidentifier NULL, + groupID uniqueidentifier NULL, + nextPermissions int NULL, + currentPermissions int NULL, + basePermissions int NULL, + everyonePermissions int NULL, + groupPermissions int NULL, + flags int NOT NULL DEFAULT ((0)) + ) ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.primitems) + EXEC('INSERT INTO dbo.Tmp_primitems (itemID, primID, assetID, parentFolderID, invType, assetType, name, description, creationDate, creatorID, ownerID, lastOwnerID, groupID, nextPermissions, currentPermissions, basePermissions, everyonePermissions, groupPermissions, flags) + SELECT CONVERT(uniqueidentifier, itemID), CONVERT(uniqueidentifier, primID), CONVERT(uniqueidentifier, assetID), CONVERT(uniqueidentifier, parentFolderID), invType, assetType, name, description, creationDate, CONVERT(uniqueidentifier, creatorID), CONVERT(uniqueidentifier, ownerID), CONVERT(uniqueidentifier, lastOwnerID), CONVERT(uniqueidentifier, groupID), nextPermissions, currentPermissions, basePermissions, everyonePermissions, groupPermissions, flags FROM dbo.primitems WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.primitems + +EXECUTE sp_rename N'dbo.Tmp_primitems', N'primitems', 'OBJECT' + +ALTER TABLE dbo.primitems ADD CONSTRAINT + PK__primitems__0A688BB1 PRIMARY KEY CLUSTERED + ( + itemID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +CREATE NONCLUSTERED INDEX primitems_primid ON dbo.primitems + ( + primID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/016_RegionStore.sql b/OpenSim/Data/MSSQL/Resources/016_RegionStore.sql new file mode 100644 index 0000000..e91da19 --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/016_RegionStore.sql @@ -0,0 +1,19 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_terrain + ( + RegionUUID uniqueidentifier NULL, + Revision int NULL, + Heightfield image NULL + ) ON [PRIMARY] + TEXTIMAGE_ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.terrain) + EXEC('INSERT INTO dbo.Tmp_terrain (RegionUUID, Revision, Heightfield) + SELECT CONVERT(uniqueidentifier, RegionUUID), Revision, Heightfield FROM dbo.terrain WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.terrain + +EXECUTE sp_rename N'dbo.Tmp_terrain', N'terrain', 'OBJECT' + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/017_RegionStore.sql b/OpenSim/Data/MSSQL/Resources/017_RegionStore.sql new file mode 100644 index 0000000..3d3dbc0 --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/017_RegionStore.sql @@ -0,0 +1,56 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_land + ( + UUID uniqueidentifier NOT NULL, + RegionUUID uniqueidentifier NULL, + LocalLandID int NULL, + Bitmap image NULL, + Name varchar(255) NULL, + Description varchar(255) NULL, + OwnerUUID uniqueidentifier NULL, + IsGroupOwned int NULL, + Area int NULL, + AuctionID int NULL, + Category int NULL, + ClaimDate int NULL, + ClaimPrice int NULL, + GroupUUID uniqueidentifier NULL, + SalePrice int NULL, + LandStatus int NULL, + LandFlags int NULL, + LandingType int NULL, + MediaAutoScale int NULL, + MediaTextureUUID uniqueidentifier NULL, + MediaURL varchar(255) NULL, + MusicURL varchar(255) NULL, + PassHours float(53) NULL, + PassPrice int NULL, + SnapshotUUID uniqueidentifier NULL, + UserLocationX float(53) NULL, + UserLocationY float(53) NULL, + UserLocationZ float(53) NULL, + UserLookAtX float(53) NULL, + UserLookAtY float(53) NULL, + UserLookAtZ float(53) NULL, + AuthbuyerID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'), + OtherCleanTime int NOT NULL DEFAULT ((0)), + Dwell int NOT NULL DEFAULT ((0)) + ) ON [PRIMARY] + TEXTIMAGE_ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.land) + EXEC('INSERT INTO dbo.Tmp_land (UUID, RegionUUID, LocalLandID, Bitmap, Name, Description, OwnerUUID, IsGroupOwned, Area, AuctionID, Category, ClaimDate, ClaimPrice, GroupUUID, SalePrice, LandStatus, LandFlags, LandingType, MediaAutoScale, MediaTextureUUID, MediaURL, MusicURL, PassHours, PassPrice, SnapshotUUID, UserLocationX, UserLocationY, UserLocationZ, UserLookAtX, UserLookAtY, UserLookAtZ, AuthbuyerID, OtherCleanTime, Dwell) + SELECT CONVERT(uniqueidentifier, UUID), CONVERT(uniqueidentifier, RegionUUID), LocalLandID, Bitmap, Name, Description, CONVERT(uniqueidentifier, OwnerUUID), IsGroupOwned, Area, AuctionID, Category, ClaimDate, ClaimPrice, CONVERT(uniqueidentifier, GroupUUID), SalePrice, LandStatus, LandFlags, LandingType, MediaAutoScale, CONVERT(uniqueidentifier, MediaTextureUUID), MediaURL, MusicURL, PassHours, PassPrice, CONVERT(uniqueidentifier, SnapshotUUID), UserLocationX, UserLocationY, UserLocationZ, UserLookAtX, UserLookAtY, UserLookAtZ, CONVERT(uniqueidentifier, AuthbuyerID), OtherCleanTime, Dwell FROM dbo.land WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.land + +EXECUTE sp_rename N'dbo.Tmp_land', N'land', 'OBJECT' + +ALTER TABLE dbo.land ADD CONSTRAINT + PK__land__65A475E71BFD2C07 PRIMARY KEY CLUSTERED + ( + UUID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/018_RegionStore.sql b/OpenSim/Data/MSSQL/Resources/018_RegionStore.sql new file mode 100644 index 0000000..6157e35 --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/018_RegionStore.sql @@ -0,0 +1,18 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_landaccesslist + ( + LandUUID uniqueidentifier NULL, + AccessUUID uniqueidentifier NULL, + Flags int NULL + ) ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.landaccesslist) + EXEC('INSERT INTO dbo.Tmp_landaccesslist (LandUUID, AccessUUID, Flags) + SELECT CONVERT(uniqueidentifier, LandUUID), CONVERT(uniqueidentifier, AccessUUID), Flags FROM dbo.landaccesslist WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.landaccesslist + +EXECUTE sp_rename N'dbo.Tmp_landaccesslist', N'landaccesslist', 'OBJECT' + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/019_RegionStore.sql b/OpenSim/Data/MSSQL/Resources/019_RegionStore.sql new file mode 100644 index 0000000..8e613b9 --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/019_RegionStore.sql @@ -0,0 +1,19 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_regionban + ( + regionUUID uniqueidentifier NOT NULL, + bannedUUID uniqueidentifier NOT NULL, + bannedIp varchar(16) NOT NULL, + bannedIpHostMask varchar(16) NOT NULL + ) ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.regionban) + EXEC('INSERT INTO dbo.Tmp_regionban (regionUUID, bannedUUID, bannedIp, bannedIpHostMask) + SELECT CONVERT(uniqueidentifier, regionUUID), CONVERT(uniqueidentifier, bannedUUID), bannedIp, bannedIpHostMask FROM dbo.regionban WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.regionban + +EXECUTE sp_rename N'dbo.Tmp_regionban', N'regionban', 'OBJECT' + +COMMIT diff --git a/OpenSim/Data/MSSQL/Resources/020_RegionStore.sql b/OpenSim/Data/MSSQL/Resources/020_RegionStore.sql new file mode 100644 index 0000000..2ce91f6 --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/020_RegionStore.sql @@ -0,0 +1,58 @@ +BEGIN TRANSACTION + +CREATE TABLE dbo.Tmp_regionsettings + ( + regionUUID uniqueidentifier NOT NULL, + block_terraform bit NOT NULL, + block_fly bit NOT NULL, + allow_damage bit NOT NULL, + restrict_pushing bit NOT NULL, + allow_land_resell bit NOT NULL, + allow_land_join_divide bit NOT NULL, + block_show_in_search bit NOT NULL, + agent_limit int NOT NULL, + object_bonus float(53) NOT NULL, + maturity int NOT NULL, + disable_scripts bit NOT NULL, + disable_collisions bit NOT NULL, + disable_physics bit NOT NULL, + terrain_texture_1 uniqueidentifier NOT NULL, + terrain_texture_2 uniqueidentifier NOT NULL, + terrain_texture_3 uniqueidentifier NOT NULL, + terrain_texture_4 uniqueidentifier NOT NULL, + elevation_1_nw float(53) NOT NULL, + elevation_2_nw float(53) NOT NULL, + elevation_1_ne float(53) NOT NULL, + elevation_2_ne float(53) NOT NULL, + elevation_1_se float(53) NOT NULL, + elevation_2_se float(53) NOT NULL, + elevation_1_sw float(53) NOT NULL, + elevation_2_sw float(53) NOT NULL, + water_height float(53) NOT NULL, + terrain_raise_limit float(53) NOT NULL, + terrain_lower_limit float(53) NOT NULL, + use_estate_sun bit NOT NULL, + fixed_sun bit NOT NULL, + sun_position float(53) NOT NULL, + covenant uniqueidentifier NULL DEFAULT (NULL), + Sandbox bit NOT NULL, + sunvectorx float(53) NOT NULL DEFAULT ((0)), + sunvectory float(53) NOT NULL DEFAULT ((0)), + sunvectorz float(53) NOT NULL DEFAULT ((0)) + ) ON [PRIMARY] + +IF EXISTS(SELECT * FROM dbo.regionsettings) + EXEC('INSERT INTO dbo.Tmp_regionsettings (regionUUID, block_terraform, block_fly, allow_damage, restrict_pushing, allow_land_resell, allow_land_join_divide, block_show_in_search, agent_limit, object_bonus, maturity, disable_scripts, disable_collisions, disable_physics, terrain_texture_1, terrain_texture_2, terrain_texture_3, terrain_texture_4, elevation_1_nw, elevation_2_nw, elevation_1_ne, elevation_2_ne, elevation_1_se, elevation_2_se, elevation_1_sw, elevation_2_sw, water_height, terrain_raise_limit, terrain_lower_limit, use_estate_sun, fixed_sun, sun_position, covenant, Sandbox, sunvectorx, sunvectory, sunvectorz) + SELECT CONVERT(uniqueidentifier, regionUUID), block_terraform, block_fly, allow_damage, restrict_pushing, allow_land_resell, allow_land_join_divide, block_show_in_search, agent_limit, object_bonus, maturity, disable_scripts, disable_collisions, disable_physics, CONVERT(uniqueidentifier, terrain_texture_1), CONVERT(uniqueidentifier, terrain_texture_2), CONVERT(uniqueidentifier, terrain_texture_3), CONVERT(uniqueidentifier, terrain_texture_4), elevation_1_nw, elevation_2_nw, elevation_1_ne, elevation_2_ne, elevation_1_se, elevation_2_se, elevation_1_sw, elevation_2_sw, water_height, terrain_raise_limit, terrain_lower_limit, use_estate_sun, fixed_sun, sun_position, CONVERT(uniqueidentifier, covenant), Sandbox, sunvectorx, sunvectory, sunvectorz FROM dbo.regionsettings WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.regionsettings + +EXECUTE sp_rename N'dbo.Tmp_regionsettings', N'regionsettings', 'OBJECT' + +ALTER TABLE dbo.regionsettings ADD CONSTRAINT + PK__regionse__5B35159D21B6055D PRIMARY KEY CLUSTERED + ( + regionUUID + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + +COMMIT -- cgit v1.1