Avatar.migrations 978 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. :VERSION 1
  2. BEGIN TRANSACTION;
  3. CREATE TABLE Avatars (
  4. "PrincipalID" uuid NOT NULL PRIMARY KEY,
  5. "Name" varchar(32) NOT NULL,
  6. "Value" varchar(255) NOT NULL DEFAULT ''
  7. );
  8. COMMIT;
  9. :VERSION 2
  10. BEGIN TRANSACTION;
  11. CREATE TABLE Tmp_Avatars
  12. (
  13. "PrincipalID" uuid NOT NULL,
  14. "Name" varchar(32) NOT NULL,
  15. "Value" text NOT NULL DEFAULT ''
  16. ) ;
  17. INSERT INTO Tmp_Avatars ("PrincipalID", "Name", "Value")
  18. SELECT "PrincipalID", cast("Name" as text), "Value"
  19. FROM Avatars ;
  20. DROP TABLE Avatars;
  21. Alter table Tmp_Avatars
  22. rename to Avatars;
  23. COMMIT;
  24. :VERSION 3
  25. BEGIN TRANSACTION;
  26. CREATE TABLE Tmp_Avatars
  27. (
  28. "PrincipalID" uuid NOT NULL,
  29. "Name" varchar(32) NOT NULL,
  30. "Value" text NOT NULL DEFAULT ''
  31. );
  32. ALTER TABLE Tmp_Avatars ADD PRIMARY KEY ("PrincipalID", "Name");
  33. INSERT INTO Tmp_Avatars ("PrincipalID", "Name", "Value")
  34. SELECT "PrincipalID", "Name", cast("Value" as text) FROM Avatars ;
  35. DROP TABLE Avatars;
  36. Alter table Tmp_Avatars
  37. rename to Avatars;
  38. COMMIT;