UserAccount.migrations 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. :VERSION 1
  2. CREATE TABLE [UserAccounts] (
  3. [PrincipalID] uniqueidentifier NOT NULL,
  4. [ScopeID] uniqueidentifier NOT NULL,
  5. [FirstName] [varchar](64) NOT NULL,
  6. [LastName] [varchar](64) NOT NULL,
  7. [Email] [varchar](64) NULL,
  8. [ServiceURLs] [text] NULL,
  9. [Created] [int] default NULL,
  10. PRIMARY KEY CLUSTERED
  11. (
  12. [PrincipalID] ASC
  13. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  14. ) ON [PRIMARY]
  15. :VERSION 2
  16. BEGIN TRANSACTION
  17. INSERT INTO UserAccounts (PrincipalID, ScopeID, FirstName, LastName, Email, ServiceURLs, Created) SELECT [UUID] AS PrincipalID, '00000000-0000-0000-0000-000000000000' AS ScopeID,
  18. username AS FirstName,
  19. lastname AS LastName,
  20. email as Email, (
  21. 'AssetServerURI=' +
  22. userAssetURI + ' InventoryServerURI=' + userInventoryURI + ' GatewayURI= HomeURI=') AS ServiceURLs,
  23. created as Created FROM users;
  24. COMMIT
  25. :VERSION 3
  26. BEGIN TRANSACTION
  27. CREATE UNIQUE INDEX PrincipalID ON UserAccounts(PrincipalID);
  28. CREATE INDEX Email ON UserAccounts(Email);
  29. CREATE INDEX FirstName ON UserAccounts(FirstName);
  30. CREATE INDEX LastName ON UserAccounts(LastName);
  31. CREATE INDEX Name ON UserAccounts(FirstName,LastName);
  32. COMMIT
  33. :VERSION 4
  34. BEGIN TRANSACTION
  35. ALTER TABLE UserAccounts ADD UserLevel integer NOT NULL DEFAULT 0;
  36. ALTER TABLE UserAccounts ADD UserFlags integer NOT NULL DEFAULT 0;
  37. ALTER TABLE UserAccounts ADD UserTitle varchar(64) NOT NULL DEFAULT '';
  38. COMMIT