004_GridStore.sql 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* To prevent any potential data loss issues, you should review this script in detail before running it outside the context of the database designer.*/
  2. BEGIN TRANSACTION
  3. CREATE TABLE dbo.Tmp_regions
  4. (
  5. uuid uniqueidentifier NOT NULL,
  6. regionHandle bigint NULL,
  7. regionName varchar(20) NULL,
  8. regionRecvKey varchar(128) NULL,
  9. regionSendKey varchar(128) NULL,
  10. regionSecret varchar(128) NULL,
  11. regionDataURI varchar(128) NULL,
  12. serverIP varchar(64) NULL,
  13. serverPort int NULL,
  14. serverURI varchar(255) NULL,
  15. locX int NULL,
  16. locY int NULL,
  17. locZ int NULL,
  18. eastOverrideHandle bigint NULL,
  19. westOverrideHandle bigint NULL,
  20. southOverrideHandle bigint NULL,
  21. northOverrideHandle bigint NULL,
  22. regionAssetURI varchar(255) NULL,
  23. regionAssetRecvKey varchar(128) NULL,
  24. regionAssetSendKey varchar(128) NULL,
  25. regionUserURI varchar(255) NULL,
  26. regionUserRecvKey varchar(128) NULL,
  27. regionUserSendKey varchar(128) NULL,
  28. regionMapTexture uniqueidentifier NULL,
  29. serverHttpPort int NULL,
  30. serverRemotingPort int NULL,
  31. owner_uuid uniqueidentifier NOT NULL,
  32. originUUID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000')
  33. ) ON [PRIMARY]
  34. IF EXISTS(SELECT * FROM dbo.regions)
  35. 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)
  36. 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)')
  37. DROP TABLE dbo.regions
  38. EXECUTE sp_rename N'dbo.Tmp_regions', N'regions', 'OBJECT'
  39. ALTER TABLE dbo.regions ADD CONSTRAINT
  40. PK__regions__uuid PRIMARY KEY CLUSTERED
  41. (
  42. uuid
  43. ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  44. CREATE NONCLUSTERED INDEX IX_regions_name ON dbo.regions
  45. (
  46. regionName
  47. ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  48. CREATE NONCLUSTERED INDEX IX_regions_handle ON dbo.regions
  49. (
  50. regionHandle
  51. ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  52. CREATE NONCLUSTERED INDEX IX_regions_override ON dbo.regions
  53. (
  54. eastOverrideHandle,
  55. westOverrideHandle,
  56. southOverrideHandle,
  57. northOverrideHandle
  58. ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  59. COMMIT