007_UserStore.sql 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. BEGIN TRANSACTION
  2. CREATE TABLE dbo.Tmp_agents
  3. (
  4. UUID uniqueidentifier NOT NULL,
  5. sessionID uniqueidentifier NOT NULL,
  6. secureSessionID uniqueidentifier NOT NULL,
  7. agentIP varchar(16) NOT NULL,
  8. agentPort int NOT NULL,
  9. agentOnline tinyint NOT NULL,
  10. loginTime int NOT NULL,
  11. logoutTime int NOT NULL,
  12. currentRegion uniqueidentifier NOT NULL,
  13. currentHandle bigint NOT NULL,
  14. currentPos varchar(64) NOT NULL
  15. ) ON [PRIMARY]
  16. IF EXISTS(SELECT * FROM dbo.agents)
  17. EXEC('INSERT INTO dbo.Tmp_agents (UUID, sessionID, secureSessionID, agentIP, agentPort, agentOnline, loginTime, logoutTime, currentRegion, currentHandle, currentPos)
  18. SELECT CONVERT(uniqueidentifier, UUID), CONVERT(uniqueidentifier, sessionID), CONVERT(uniqueidentifier, secureSessionID), agentIP, agentPort, agentOnline, loginTime, logoutTime, CONVERT(uniqueidentifier, currentRegion), currentHandle, currentPos FROM dbo.agents WITH (HOLDLOCK TABLOCKX)')
  19. DROP TABLE dbo.agents
  20. EXECUTE sp_rename N'dbo.Tmp_agents', N'agents', 'OBJECT'
  21. ALTER TABLE dbo.agents ADD CONSTRAINT
  22. PK__agents__65A475E749C3F6B7 PRIMARY KEY CLUSTERED
  23. (
  24. UUID
  25. ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  26. CREATE NONCLUSTERED INDEX session ON dbo.agents
  27. (
  28. sessionID
  29. ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  30. CREATE NONCLUSTERED INDEX ssession ON dbo.agents
  31. (
  32. secureSessionID
  33. ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  34. COMMIT