1
0

006_UserStore.sql 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. BEGIN TRANSACTION
  2. CREATE TABLE dbo.Tmp_users
  3. (
  4. UUID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
  5. username varchar(32) NOT NULL,
  6. lastname varchar(32) NOT NULL,
  7. passwordHash varchar(32) NOT NULL,
  8. passwordSalt varchar(32) NOT NULL,
  9. homeRegion bigint NULL DEFAULT (NULL),
  10. homeLocationX float(53) NULL DEFAULT (NULL),
  11. homeLocationY float(53) NULL DEFAULT (NULL),
  12. homeLocationZ float(53) NULL DEFAULT (NULL),
  13. homeLookAtX float(53) NULL DEFAULT (NULL),
  14. homeLookAtY float(53) NULL DEFAULT (NULL),
  15. homeLookAtZ float(53) NULL DEFAULT (NULL),
  16. created int NOT NULL,
  17. lastLogin int NOT NULL,
  18. userInventoryURI varchar(255) NULL DEFAULT (NULL),
  19. userAssetURI varchar(255) NULL DEFAULT (NULL),
  20. profileCanDoMask int NULL DEFAULT (NULL),
  21. profileWantDoMask int NULL DEFAULT (NULL),
  22. profileAboutText ntext NULL,
  23. profileFirstText ntext NULL,
  24. profileImage uniqueidentifier NULL DEFAULT (NULL),
  25. profileFirstImage uniqueidentifier NULL DEFAULT (NULL),
  26. webLoginKey uniqueidentifier NULL DEFAULT (NULL),
  27. homeRegionID uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
  28. userFlags int NOT NULL DEFAULT ((0)),
  29. godLevel int NOT NULL DEFAULT ((0)),
  30. customType varchar(32) NOT NULL DEFAULT (''),
  31. partner uniqueidentifier NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
  32. email varchar(250) NULL
  33. ) ON [PRIMARY]
  34. TEXTIMAGE_ON [PRIMARY]
  35. IF EXISTS(SELECT * FROM dbo.users)
  36. EXEC('INSERT INTO dbo.Tmp_users (UUID, username, lastname, passwordHash, passwordSalt, homeRegion, homeLocationX, homeLocationY, homeLocationZ, homeLookAtX, homeLookAtY, homeLookAtZ, created, lastLogin, userInventoryURI, userAssetURI, profileCanDoMask, profileWantDoMask, profileAboutText, profileFirstText, profileImage, profileFirstImage, webLoginKey, homeRegionID, userFlags, godLevel, customType, partner, email)
  37. SELECT CONVERT(uniqueidentifier, UUID), username, lastname, passwordHash, passwordSalt, homeRegion, homeLocationX, homeLocationY, homeLocationZ, homeLookAtX, homeLookAtY, homeLookAtZ, created, lastLogin, userInventoryURI, userAssetURI, profileCanDoMask, profileWantDoMask, profileAboutText, profileFirstText, CONVERT(uniqueidentifier, profileImage), CONVERT(uniqueidentifier, profileFirstImage), CONVERT(uniqueidentifier, webLoginKey), CONVERT(uniqueidentifier, homeRegionID), userFlags, godLevel, customType, CONVERT(uniqueidentifier, partner), email FROM dbo.users WITH (HOLDLOCK TABLOCKX)')
  38. DROP TABLE dbo.users
  39. EXECUTE sp_rename N'dbo.Tmp_users', N'users', 'OBJECT'
  40. ALTER TABLE dbo.users ADD CONSTRAINT
  41. PK__users__65A475E737A5467C PRIMARY KEY CLUSTERED
  42. (
  43. UUID
  44. ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  45. CREATE NONCLUSTERED INDEX usernames ON dbo.users
  46. (
  47. username,
  48. lastname
  49. ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  50. COMMIT