mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-10 16:33:11 -06:00
Namespace the tables
This commit is contained in:
parent
749fd213a0
commit
6328900d06
|
|
@ -21,7 +21,7 @@ import (
|
|||
)
|
||||
|
||||
const inviteSchema = `
|
||||
CREATE TABLE IF NOT EXISTS invites (
|
||||
CREATE TABLE IF NOT EXISTS roomserver_invites (
|
||||
-- The string ID of the invite event itself.
|
||||
-- We can't use a numeric event ID here because we don't always have
|
||||
-- enough information to store an invite in the event table.
|
||||
|
|
@ -47,16 +47,16 @@ CREATE TABLE IF NOT EXISTS invites (
|
|||
invite_event_json TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS invites_active_idx ON invites (target_nid, room_nid)
|
||||
CREATE INDEX IF NOT EXISTS roomserver_invites_active_idx ON invites (target_nid, room_nid)
|
||||
WHERE NOT retired;
|
||||
`
|
||||
const insertInviteEventSQL = "" +
|
||||
"INSERT INTO invites (invite_event_id, room_nid, target_nid," +
|
||||
"INSERT INTO roomserver_invites (invite_event_id, room_nid, target_nid," +
|
||||
" sender_nid, invite_event_json) VALUES ($1, $2, $3, $4, $5)" +
|
||||
" ON CONFLICT DO NOTHING"
|
||||
|
||||
const selectInviteActiveForUserInRoomSQL = "" +
|
||||
"SELECT invite_event_id, sender_nid FROM invites" +
|
||||
"SELECT invite_event_id, sender_nid FROM roomserver_invites" +
|
||||
" WHERE target_nid = $1 AND room_nid = $2" +
|
||||
" AND NOT retired"
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ const selectInviteActiveForUserInRoomSQL = "" +
|
|||
// However the matrix protocol doesn't give us a way to reliably identify the
|
||||
// invites that were retired, so we are forced to retire all of them.
|
||||
const updateInviteRetiredSQL = "" +
|
||||
"UPDATE invites SET retired = TRUE" +
|
||||
"UPDATE roomserver_invites SET retired = TRUE" +
|
||||
" WHERE room_nid = $1 AND target_nid = $2 AND NOT retired" +
|
||||
" RETURNING invite_event_id"
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ const membershipSchema = `
|
|||
-- 1) The membership of a user changes within the current state of the room.
|
||||
-- 2) An invite is received outside of a room over federation.
|
||||
-- 3) An invite is rejected outside of a room over federation.
|
||||
CREATE TABLE IF NOT EXISTS membership (
|
||||
CREATE TABLE IF NOT EXISTS roomserver_membership (
|
||||
room_nid BIGINT NOT NULL,
|
||||
-- Numeric state key ID for the user ID this state is for.
|
||||
target_nid BIGINT NOT NULL,
|
||||
|
|
@ -48,16 +48,16 @@ CREATE TABLE IF NOT EXISTS membership (
|
|||
`
|
||||
|
||||
const insertMembershipSQL = "" +
|
||||
"INSERT INTO membership (room_nid, target_nid)" +
|
||||
"INSERT INTO roomserver_membership (room_nid, target_nid)" +
|
||||
" VALUES ($1, $2)" +
|
||||
" ON CONFLICT DO NOTHING"
|
||||
|
||||
const selectMembershipForUpdateSQL = "" +
|
||||
"SELECT membership_nid FROM membership" +
|
||||
"SELECT membership_nid FROM roomserver_membership" +
|
||||
" WHERE room_nid = $1 AND target_nid = $2 FOR UPDATE"
|
||||
|
||||
const updateMembershipSQL = "" +
|
||||
"UPDATE membership SET sender_nid = $3, membership_nid = $4" +
|
||||
"UPDATE roomserver_membership SET sender_nid = $3, membership_nid = $4" +
|
||||
" WHERE room_nid = $1 AND target_nid = $2"
|
||||
|
||||
type membershipStatements struct {
|
||||
|
|
|
|||
Loading…
Reference in a new issue