Files

19 lines
694 B
SQL
Raw Permalink Normal View History

-- CEO direct inbox (@ervoorz / @aissa)
CREATE TABLE IF NOT EXISTS warroom_ceo_inbox (
id BIGSERIAL PRIMARY KEY,
message_id BIGINT REFERENCES warroom_messages(id) ON DELETE CASCADE,
room_id BIGINT REFERENCES warroom_rooms(id) ON DELETE CASCADE,
agent_key VARCHAR(64),
content TEXT NOT NULL,
excerpt TEXT,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
read_at TIMESTAMPTZ,
recipient TEXT NOT NULL DEFAULT 'aissa'
);
CREATE INDEX IF NOT EXISTS warroom_ceo_inbox_unread
ON warroom_ceo_inbox (recipient, read_at, created_at DESC);
CREATE INDEX IF NOT EXISTS warroom_ceo_inbox_created
ON warroom_ceo_inbox (created_at DESC);