Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
Fix portal store migration
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewFerr committed Feb 14, 2024
1 parent 6290737 commit 4260bc7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion database/upgrades/16-refactor-postgres.sql
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ INSERT INTO lost_portals SELECT mxid, chat_id, receiver FROM portal WHERE mxid<>
UPDATE portal SET mxid=NULL WHERE mxid='';
ALTER TABLE portal ADD CONSTRAINT portal_mxid_unique UNIQUE(mxid);
-- Delete any portals that aren't associated with logged-in users.
DELETE FROM portal WHERE receiver<>'' AND receiver NOT IN (SELECT username FROM "user" WHERE uuid IS NOT NULL);
DELETE FROM portal WHERE receiver<>'' AND receiver NOT IN (SELECT username FROM "user" WHERE username IS NOT NULL AND uuid IS NOT NULL);
-- Change receiver to uuid instead of phone number, also add nil uuid for groups.
UPDATE portal SET receiver=(SELECT uuid FROM "user" WHERE username=receiver AND uuid IS NOT NULL LIMIT 1) WHERE receiver<>'';
UPDATE portal SET receiver='00000000-0000-0000-0000-000000000000' WHERE receiver='';
Expand Down

0 comments on commit 4260bc7

Please sign in to comment.