From d4043c084a86da5f462356ec5c65eab2b861564d Mon Sep 17 00:00:00 2001 From: Chris Hart Date: Tue, 13 Sep 2011 16:55:30 -0400 Subject: MSSQL Bug fix in user account retrieval, plus migrations for FriendsStore and InventoryStore --- .../Data/MSSQL/Resources/FriendsStore.migrations | 28 +++++++++++++++++++ .../Data/MSSQL/Resources/InventoryStore.migrations | 32 ++++++++++++++++++++++ 2 files changed, 60 insertions(+) (limited to 'OpenSim/Data/MSSQL/Resources') diff --git a/OpenSim/Data/MSSQL/Resources/FriendsStore.migrations b/OpenSim/Data/MSSQL/Resources/FriendsStore.migrations index 4d8ab0f..cc94c4e 100644 --- a/OpenSim/Data/MSSQL/Resources/FriendsStore.migrations +++ b/OpenSim/Data/MSSQL/Resources/FriendsStore.migrations @@ -19,4 +19,32 @@ IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[userf INSERT INTO Friends (PrincipalID, Friend, Flags, Offered) SELECT [ownerID], [friendID], [friendPerms], 0 FROM userfriends; +COMMIT + +:VERSION 3 + +BEGIN TRANSACTION + +CREATE TABLE [Tmp_Friends] + ([PrincipalID] varchar(255) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', +[Friend] varchar(255) NOT NULL, +[Flags] char(16) NOT NULL DEFAULT '0', +[Offered] varchar(32) NOT NULL DEFAULT 0) +ON [PRIMARY] + + +IF EXISTS(SELECT * FROM dbo.Friends) + EXEC('INSERT INTO dbo.Tmp_Friends (PrincipalID, Friend, Flags, Offered) + SELECT CONVERT(varchar(255),PrincipalID), Friend, Flags, Offered FROM dbo.Friends WITH (HOLDLOCK TABLOCKX)') + +DROP TABLE dbo.Friends + +EXECUTE sp_rename N'dbo.Tmp_Friends', N'Friends', 'OBJECT' + +ALTER TABLE dbo.Friends ADD + PRIMARY KEY CLUSTERED +( + [PrincipalID] ASC, [Friend] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] + COMMIT \ No newline at end of file diff --git a/OpenSim/Data/MSSQL/Resources/InventoryStore.migrations b/OpenSim/Data/MSSQL/Resources/InventoryStore.migrations index 4a3cb27..4e43653 100644 --- a/OpenSim/Data/MSSQL/Resources/InventoryStore.migrations +++ b/OpenSim/Data/MSSQL/Resources/InventoryStore.migrations @@ -244,4 +244,36 @@ ALTER TABLE inventoryitems ADD CONSTRAINT DF_inventoryitems_creatorID DEFAULT '00000000-0000-0000-0000-000000000000' FOR creatorID +:GO + +:VERSION 9 + +BEGIN TRANSACTION + +# CreatorID goes up to VARCHAR(255) + +exec sp_rename 'inventoryitems.CreatorID', 'cr_old', 'COLUMN' + +:GO + +alter table inventoryitems + add creatorID varchar(255) NULL + +:GO + +update inventoryitems set creatorID = cr_old + +alter table inventoryitems +drop CONSTRAINT DF_inventoryitems_creatorID +:GO + +alter table inventoryitems + drop column cr_old + :GO +COMMIT + +ALTER TABLE inventoryitems +ADD CONSTRAINT DF_inventoryitems_creatorID +DEFAULT '00000000-0000-0000-0000-000000000000' FOR creatorID + :GO \ No newline at end of file -- cgit v1.1