1
0

FriendsStore.migrations 950 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. :VERSION 1
  2. BEGIN TRANSACTION;
  3. CREATE TABLE Friends (
  4. "PrincipalID" uuid NOT NULL,
  5. "Friend" varchar(255) NOT NULL,
  6. "Flags" char(16) NOT NULL DEFAULT '0',
  7. "Offered" varchar(32) NOT NULL DEFAULT 0);
  8. COMMIT;
  9. :VERSION 2
  10. BEGIN TRANSACTION;
  11. INSERT INTO Friends ("PrincipalID", "Friend", "Flags", "Offered")
  12. SELECT "ownerID", "friendID", "friendPerms", 0 FROM userfriends;
  13. COMMIT;
  14. :VERSION 3
  15. BEGIN TRANSACTION;
  16. CREATE TABLE Tmp_Friends
  17. ("PrincipalID" varchar(255) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
  18. "Friend" varchar(255) NOT NULL,
  19. "Flags" char(16) NOT NULL DEFAULT '0',
  20. "Offered" varchar(32) NOT NULL DEFAULT 0) ;
  21. INSERT INTO Tmp_Friends ("PrincipalID", "Friend", "Flags", "Offered")
  22. SELECT cast("PrincipalID" as varchar(255)), "Friend", "Flags", "Offered" FROM Friends ;
  23. DROP TABLE Friends;
  24. Alter table Tmp_Friends
  25. rename to Friends;
  26. ALTER TABLE Friends ADD PRIMARY KEY("PrincipalID", "Friend");
  27. COMMIT;