UserAccount.migrations 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. :VERSION 1
  2. CREATE TABLE UserAccounts (
  3. "PrincipalID" uuid NOT NULL Primary key,
  4. "ScopeID" uuid 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. );
  11. :VERSION 2
  12. BEGIN TRANSACTION;
  13. INSERT INTO UserAccounts ("PrincipalID", "ScopeID", "FirstName", "LastName", "Email", "ServiceURLs", "Created")
  14. SELECT UUID AS "PrincipalID", '00000000-0000-0000-0000-000000000000' AS "ScopeID",
  15. username AS "FirstName",
  16. lastname AS "LastName",
  17. email as "Email", (
  18. 'AssetServerURI=' +
  19. userAssetURI + ' InventoryServerURI=' + userInventoryURI + ' GatewayURI= HomeURI=') AS "ServiceURLs",
  20. created as "Created" FROM users;
  21. COMMIT;
  22. :VERSION 3
  23. BEGIN TRANSACTION;
  24. CREATE UNIQUE INDEX "PrincipalID" ON UserAccounts("PrincipalID");
  25. CREATE INDEX "Email" ON UserAccounts("Email");
  26. CREATE INDEX "FirstName" ON UserAccounts("FirstName");
  27. CREATE INDEX "LastName" ON UserAccounts("LastName");
  28. CREATE INDEX Name ON UserAccounts("FirstName","LastName");
  29. COMMIT;
  30. :VERSION 4
  31. BEGIN TRANSACTION;
  32. ALTER TABLE UserAccounts ADD "UserLevel" integer NOT NULL DEFAULT 0;
  33. ALTER TABLE UserAccounts ADD "UserFlags" integer NOT NULL DEFAULT 0;
  34. ALTER TABLE UserAccounts ADD "UserTitle" varchar(64) NOT NULL DEFAULT '';
  35. COMMIT;
  36. :VERSION 5
  37. BEGIN TRANSACTION;
  38. ALTER TABLE UserAccounts ADD "active" integer NOT NULL DEFAULT 1;
  39. COMMIT;