-
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hicli/database: store DM user ID in database
- Loading branch information
Showing
9 changed files
with
73 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
-- v11 (compatible with v10+): Store direct chat user ID in database | ||
ALTER TABLE room ADD COLUMN dm_user_id TEXT; | ||
WITH dm_user_ids AS ( | ||
SELECT room_id, value | ||
FROM room | ||
INNER JOIN json_each(lazy_load_summary, '$."m.heroes"') | ||
WHERE value NOT IN (SELECT value FROM json_each(( | ||
SELECT event.content | ||
FROM current_state cs | ||
INNER JOIN event ON cs.event_rowid = event.rowid | ||
WHERE cs.room_id=room.room_id AND cs.event_type='io.element.functional_members' AND cs.state_key='' | ||
), '$.service_members')) | ||
GROUP BY room_id | ||
HAVING COUNT(*) = 1 | ||
) | ||
UPDATE room | ||
SET dm_user_id=value | ||
FROM dm_user_ids du | ||
WHERE room.room_id=du.room_id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters