home / chat

destination_rooms

0 rows where room_id = "!kKtScliyhdpXGYJoyR:matrix.jamesst.one"

✎ View and edit SQL

This data as json

0 records

CREATE TABLE destination_rooms (
  -- the destination in question.
  destination TEXT NOT NULL REFERENCES destinations (destination),
  -- the ID of the room in question
  room_id TEXT NOT NULL REFERENCES rooms (room_id),
  -- the stream_ordering of the event
  stream_ordering BIGINT NOT NULL,
  PRIMARY KEY (destination, room_id)
  -- We don't declare a foreign key on stream_ordering here because that'd mean
  -- we'd need to either maintain an index (expensive) or do a table scan of
  -- destination_rooms whenever we delete an event (also potentially expensive).
  -- In addition to that, a foreign key on stream_ordering would be redundant
  -- as this row doesn't need to refer to a specific event; if the event gets
  -- deleted then it doesn't affect the validity of the stream_ordering here.
);
CREATE INDEX destination_rooms_room_id
    ON destination_rooms (room_id);
Powered by Datasette · Queries took 13.122ms