UserAccount.migrations 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. :VERSION 1 # -------------------------
  2. BEGIN;
  3. CREATE TABLE `UserAccounts` (
  4. `PrincipalID` CHAR(36) NOT NULL,
  5. `ScopeID` CHAR(36) NOT NULL,
  6. `FirstName` VARCHAR(64) NOT NULL,
  7. `LastName` VARCHAR(64) NOT NULL,
  8. `Email` VARCHAR(64),
  9. `ServiceURLs` TEXT,
  10. `Created` INT(11)
  11. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  12. COMMIT;
  13. :VERSION 2 # -------------------------
  14. BEGIN;
  15. INSERT INTO UserAccounts (PrincipalID, ScopeID, FirstName, LastName, Email, ServiceURLs, Created) SELECT `UUID` AS PrincipalID, '00000000-0000-0000-0000-000000000000' AS ScopeID, username AS FirstName, lastname AS LastName, email as Email, CONCAT('AssetServerURI=', userAssetURI, ' InventoryServerURI=', userInventoryURI, ' GatewayURI= HomeURI=') AS ServiceURLs, created as Created FROM users;
  16. COMMIT;
  17. :VERSION 3 # -------------------------
  18. BEGIN;
  19. CREATE UNIQUE INDEX PrincipalID ON UserAccounts(PrincipalID);
  20. CREATE INDEX Email ON UserAccounts(Email);
  21. CREATE INDEX FirstName ON UserAccounts(FirstName);
  22. CREATE INDEX LastName ON UserAccounts(LastName);
  23. CREATE INDEX Name ON UserAccounts(FirstName,LastName);
  24. COMMIT;
  25. :VERSION 4 # -------------------------
  26. BEGIN;
  27. ALTER TABLE UserAccounts ADD COLUMN UserLevel integer NOT NULL DEFAULT 0;
  28. ALTER TABLE UserAccounts ADD COLUMN UserFlags integer NOT NULL DEFAULT 0;
  29. ALTER TABLE UserAccounts ADD COLUMN UserTitle varchar(64) NOT NULL DEFAULT '';
  30. COMMIT;