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/Resources/004_GridStore.sql | 68 ++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 OpenSim/Data/MSSQL/Resources/004_GridStore.sql

(limited to 'OpenSim/Data/MSSQL/Resources/004_GridStore.sql')

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
-- 
cgit v1.1

