home / chat

sticky_events

✎ View and edit SQL

This data as json

0 records

CREATE TABLE sticky_events (
  -- Position in the sticky events stream
  stream_id INTEGER NOT NULL PRIMARY KEY,

  -- Name of the worker sending this. (This makes the stream compatible with multiple writers.)
  instance_name TEXT NOT NULL,

  -- The event ID of the sticky event itself.
  event_id TEXT NOT NULL,

  -- The room ID that the sticky event is in.
  -- Denormalised for performance. (Safe as it's an immutable property of the event.)
  room_id TEXT NOT NULL,

  -- The stream_ordering of the event.
  -- Denormalised for performance since we will want to sort these by stream_ordering
  -- when fetching them. (Safe as it's an immutable property of the event.)
  event_stream_ordering INTEGER NOT NULL UNIQUE,

  -- Sender of the sticky event.
  -- Denormalised for performance so we can query only for sticky events originating
  -- from our homeserver. (Safe as it's an immutable property of the event.)
  sender TEXT NOT NULL,

  -- When the sticky event expires, in milliseconds since the Unix epoch.
  expires_at BIGINT NOT NULL
);
CREATE INDEX sticky_events_room_idx ON sticky_events (room_id, event_stream_ordering);
Powered by Datasette · Queries took 26.795ms