004_InventoryStore.sql 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. BEGIN TRANSACTION
  2. CREATE TABLE dbo.Tmp_inventoryitems
  3. (
  4. inventoryID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
  5. assetID uniqueidentifier NULL DEFAULT (NULL),
  6. assetType int NULL DEFAULT (NULL),
  7. parentFolderID uniqueidentifier NULL DEFAULT (NULL),
  8. avatarID uniqueidentifier NULL DEFAULT (NULL),
  9. inventoryName varchar(64) NULL DEFAULT (NULL),
  10. inventoryDescription varchar(128) NULL DEFAULT (NULL),
  11. inventoryNextPermissions int NULL DEFAULT (NULL),
  12. inventoryCurrentPermissions int NULL DEFAULT (NULL),
  13. invType int NULL DEFAULT (NULL),
  14. creatorID uniqueidentifier NULL DEFAULT (NULL),
  15. inventoryBasePermissions int NOT NULL DEFAULT ((0)),
  16. inventoryEveryOnePermissions int NOT NULL DEFAULT ((0)),
  17. salePrice int NULL DEFAULT (NULL),
  18. saleType tinyint NULL DEFAULT (NULL),
  19. creationDate int NULL DEFAULT (NULL),
  20. groupID uniqueidentifier NULL DEFAULT (NULL),
  21. groupOwned bit NULL DEFAULT (NULL),
  22. flags int NULL DEFAULT (NULL),
  23. inventoryGroupPermissions int NOT NULL DEFAULT ((0))
  24. ) ON [PRIMARY]
  25. IF EXISTS(SELECT * FROM dbo.inventoryitems)
  26. 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)
  27. 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)')
  28. DROP TABLE dbo.inventoryitems
  29. EXECUTE sp_rename N'dbo.Tmp_inventoryitems', N'inventoryitems', 'OBJECT'
  30. ALTER TABLE dbo.inventoryitems ADD CONSTRAINT
  31. PK__inventor__C4B7BC2220C1E124 PRIMARY KEY CLUSTERED
  32. (
  33. inventoryID
  34. ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  35. CREATE NONCLUSTERED INDEX owner ON dbo.inventoryitems
  36. (
  37. avatarID
  38. ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  39. CREATE NONCLUSTERED INDEX folder ON dbo.inventoryitems
  40. (
  41. parentFolderID
  42. ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  43. COMMIT