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

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

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

