This commit is contained in:
Mark Haines 2017-08-07 15:50:00 +01:00
parent fdcf72836a
commit 1ed74d4123
2 changed files with 8 additions and 5 deletions

View file

@ -56,7 +56,7 @@ const insertInviteEventSQL = "" +
" ON CONFLICT DO NOTHING"
const selectInviteActiveForUserInRoomSQL = "" +
"SELECT invite_event_id, sender_nid FROM roomserver_invites" +
"SELECT sender_nid FROM roomserver_invites" +
" WHERE target_nid = $1 AND room_nid = $2" +
" AND NOT retired"

View file

@ -23,9 +23,9 @@ import (
type membershipState int64
const (
membershipStateLeaveOrBan membershipState = 0
membershipStateInvite membershipState = 1
membershipStateJoin membershipState = 2
membershipStateLeaveOrBan membershipState = 1
membershipStateInvite membershipState = 2
membershipStateJoin membershipState = 3
)
const membershipSchema = `
@ -40,9 +40,12 @@ CREATE TABLE IF NOT EXISTS roomserver_membership (
-- Numeric state key ID for the user ID this state is for.
target_nid BIGINT NOT NULL,
-- Numeric state key ID for the user ID who changed the state.
-- This may be 0 since it is not always possible to identify the user that
-- changed the state.
sender_nid BIGINT NOT NULL DEFAULT 0,
-- The state the user is in within this room.
membership_nid BIGINT NOT NULL DEFAULT 0,
-- Default value is "membershipStateLeaveOrBan"
membership_nid BIGINT NOT NULL DEFAULT 1,
UNIQUE (room_nid, target_nid)
);
`