From 187a98615bd73a0a21b66e7137658939fe4664e2 Mon Sep 17 00:00:00 2001 From: AlexRa Date: Wed, 19 May 2010 10:28:10 +0300 Subject: MSSQL: added asset_flags, CreatorID to migrations --- OpenSim/Data/MSSQL/Resources/AssetStore.migrations | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Data/MSSQL/Resources') diff --git a/OpenSim/Data/MSSQL/Resources/AssetStore.migrations b/OpenSim/Data/MSSQL/Resources/AssetStore.migrations index beb82b9..8664ce9 100644 --- a/OpenSim/Data/MSSQL/Resources/AssetStore.migrations +++ b/OpenSim/Data/MSSQL/Resources/AssetStore.migrations @@ -97,4 +97,10 @@ COMMIT DELETE FROM assets WHERE id = 'dc4b9f0b-d008-45c6-96a4-01dd947ac621'; +:VERSION 6 +ALTER TABLE assets ADD asset_flags INTEGER NOT NULL DEFAULT 0; + +:VERSION 7 + +alter table assets add creatorid varchar(36) not null default ''; -- cgit v1.1 From 52a3dbd076394a67d165a5b1f852a5bc9ac918d4 Mon Sep 17 00:00:00 2001 From: AlexRa Date: Sun, 23 May 2010 11:34:56 +0300 Subject: MSSQL Migration: CreatorID in InventoryItems changed to VARCHAR(36) Again, the same thing about potentially having non-GUID CreatorID. --- .../Data/MSSQL/Resources/InventoryStore.migrations | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'OpenSim/Data/MSSQL/Resources') diff --git a/OpenSim/Data/MSSQL/Resources/InventoryStore.migrations b/OpenSim/Data/MSSQL/Resources/InventoryStore.migrations index cd5dfdc..e2a8d57 100644 --- a/OpenSim/Data/MSSQL/Resources/InventoryStore.migrations +++ b/OpenSim/Data/MSSQL/Resources/InventoryStore.migrations @@ -171,4 +171,74 @@ CREATE NONCLUSTERED INDEX folder ON dbo.inventoryitems COMMIT +:VERSION 5 + +# It would be totally crazy to have to recreate the whole table just to change one column type, +# just because MS SQL treats each DEFAULT as a constraint object that must be dropped +# before anything can be done to the column. Since all defaults here are unnamed, there is +# no easy way to drop them! The hairy piece of code below removes all DEFAULT constraints +# from InventoryItems. + +# SO: anything that's NULLable is by default NULL, so please don't declare DEFAULT(NULL), +# they do nothing but prevent changes to the columns. If you really +# need to have DEFAULTs or other constraints, give them names so they can be dropped when needed! + +BEGIN TRANSACTION +DECLARE @nm varchar(80); +DECLARE x CURSOR LOCAL FORWARD_ONLY READ_ONLY + FOR SELECT name FROM sys.default_constraints where parent_object_id = OBJECT_ID('inventoryitems'); +OPEN x; +FETCH NEXT FROM x INTO @nm; +WHILE @@FETCH_STATUS = 0 +BEGIN + EXEC('alter table inventoryitems drop ' + @nm); + FETCH NEXT FROM x INTO @nm; +END +CLOSE x +DEALLOCATE x +COMMIT + +# all DEFAULTs dropped! + +:GO + +BEGIN TRANSACTION + +# Restoring defaults: +# NOTE: [inventoryID] does NOT need one: it's NOT NULL PK and a unique Guid must be provided every time anyway! + +alter table inventoryitems + add constraint def_baseperm default 0 for inventoryBasePermissions +alter table inventoryitems + add constraint def_allperm default 0 for inventoryEveryOnePermissions +alter table inventoryitems + add constraint def_grpperm default 0 for inventoryGroupPermissions + +COMMIT + +:VERSION 7 + +BEGIN TRANSACTION + +# CreatorID goes back to VARCHAR(36) (???) + +exec sp_rename 'inventoryitems.CreatorID', 'cr_old', 'COLUMN' + +:GO + +alter table inventoryitems + add creatorID varchar(36) NULL + +:GO + +update inventoryitems set creatorID = CONVERT(VARCHAR(36), cr_old) + +alter table inventoryitems + drop column cr_old + +COMMIT + + + + -- cgit v1.1 From b9b6d9c4ea1dc3aacda1799d5603a06a5b704db7 Mon Sep 17 00:00:00 2001 From: AlexRa Date: Sun, 23 May 2010 11:41:44 +0300 Subject: Removed (unused?) empty SQL files from MSSQL resource dir There was a whole bunch of these SQL files, all empty and apparently unused. Removing them is just a clean-up, if anybody has a reason for these files to be there, feel free to revert. --- OpenSim/Data/MSSQL/Resources/AvatarAppearance.sql | 0 OpenSim/Data/MSSQL/Resources/CreateAssetsTable.sql | 0 OpenSim/Data/MSSQL/Resources/CreateFoldersTable.sql | 0 OpenSim/Data/MSSQL/Resources/CreateItemsTable.sql | 0 OpenSim/Data/MSSQL/Resources/CreateUserFriendsTable.sql | 0 OpenSim/Data/MSSQL/Resources/Mssql-agents.sql | 0 OpenSim/Data/MSSQL/Resources/Mssql-logs.sql | 0 OpenSim/Data/MSSQL/Resources/Mssql-regions.sql | 0 OpenSim/Data/MSSQL/Resources/Mssql-users.sql | 0 9 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 OpenSim/Data/MSSQL/Resources/AvatarAppearance.sql delete mode 100644 OpenSim/Data/MSSQL/Resources/CreateAssetsTable.sql delete mode 100644 OpenSim/Data/MSSQL/Resources/CreateFoldersTable.sql delete mode 100644 OpenSim/Data/MSSQL/Resources/CreateItemsTable.sql delete mode 100644 OpenSim/Data/MSSQL/Resources/CreateUserFriendsTable.sql delete mode 100644 OpenSim/Data/MSSQL/Resources/Mssql-agents.sql delete mode 100644 OpenSim/Data/MSSQL/Resources/Mssql-logs.sql delete mode 100644 OpenSim/Data/MSSQL/Resources/Mssql-regions.sql delete mode 100644 OpenSim/Data/MSSQL/Resources/Mssql-users.sql (limited to 'OpenSim/Data/MSSQL/Resources') diff --git a/OpenSim/Data/MSSQL/Resources/AvatarAppearance.sql b/OpenSim/Data/MSSQL/Resources/AvatarAppearance.sql deleted file mode 100644 index e69de29..0000000 diff --git a/OpenSim/Data/MSSQL/Resources/CreateAssetsTable.sql b/OpenSim/Data/MSSQL/Resources/CreateAssetsTable.sql deleted file mode 100644 index e69de29..0000000 diff --git a/OpenSim/Data/MSSQL/Resources/CreateFoldersTable.sql b/OpenSim/Data/MSSQL/Resources/CreateFoldersTable.sql deleted file mode 100644 index e69de29..0000000 diff --git a/OpenSim/Data/MSSQL/Resources/CreateItemsTable.sql b/OpenSim/Data/MSSQL/Resources/CreateItemsTable.sql deleted file mode 100644 index e69de29..0000000 diff --git a/OpenSim/Data/MSSQL/Resources/CreateUserFriendsTable.sql b/OpenSim/Data/MSSQL/Resources/CreateUserFriendsTable.sql deleted file mode 100644 index e69de29..0000000 diff --git a/OpenSim/Data/MSSQL/Resources/Mssql-agents.sql b/OpenSim/Data/MSSQL/Resources/Mssql-agents.sql deleted file mode 100644 index e69de29..0000000 diff --git a/OpenSim/Data/MSSQL/Resources/Mssql-logs.sql b/OpenSim/Data/MSSQL/Resources/Mssql-logs.sql deleted file mode 100644 index e69de29..0000000 diff --git a/OpenSim/Data/MSSQL/Resources/Mssql-regions.sql b/OpenSim/Data/MSSQL/Resources/Mssql-regions.sql deleted file mode 100644 index e69de29..0000000 diff --git a/OpenSim/Data/MSSQL/Resources/Mssql-users.sql b/OpenSim/Data/MSSQL/Resources/Mssql-users.sql deleted file mode 100644 index e69de29..0000000 -- cgit v1.1