AuthStore.migrations 991 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. :VERSION 1 # -------------------------------
  2. begin;
  3. CREATE TABLE `auth` (
  4. `UUID` char(36) NOT NULL,
  5. `passwordHash` char(32) NOT NULL default '',
  6. `passwordSalt` char(32) NOT NULL default '',
  7. `webLoginKey` varchar(255) NOT NULL default '',
  8. PRIMARY KEY (`UUID`)
  9. ) ENGINE=InnoDB;
  10. CREATE TABLE `tokens` (
  11. `UUID` char(36) NOT NULL,
  12. `token` varchar(255) NOT NULL,
  13. `validity` datetime NOT NULL,
  14. UNIQUE KEY `uuid_token` (`UUID`,`token`),
  15. KEY `UUID` (`UUID`),
  16. KEY `token` (`token`),
  17. KEY `validity` (`validity`)
  18. ) ENGINE=InnoDB;
  19. commit;
  20. :VERSION 2 # -------------------------------
  21. BEGIN;
  22. INSERT INTO auth (UUID, passwordHash, passwordSalt, webLoginKey) SELECT `UUID` AS UUID, `passwordHash` AS passwordHash, `passwordSalt` AS passwordSalt, `webLoginKey` AS webLoginKey FROM users;
  23. COMMIT;
  24. :VERSION 3 # -------------------------------
  25. BEGIN;
  26. ALTER TABLE `auth` ADD COLUMN `accountType` VARCHAR(32) NOT NULL DEFAULT 'UserAccount';
  27. COMMIT;