gitdataai/libs/migrate/sql/m20250628_000061_create_room_message.sql
2026-04-15 09:08:09 +08:00

19 lines
565 B
SQL

CREATE TABLE IF NOT EXISTS room_message (
id UUID PRIMARY KEY,
seq BIGINT NOT NULL,
room UUID NOT NULL,
sender_type VARCHAR(255) NOT NULL,
sender_id UUID,
thread UUID,
content TEXT NOT NULL,
content_type VARCHAR(255) NOT NULL,
edited_at TIMESTAMPTZ,
send_at TIMESTAMPTZ NOT NULL,
revoked TIMESTAMPTZ,
revoked_by UUID
);
CREATE INDEX idx_room_message_room_seq ON room_message (room, seq);
CREATE INDEX idx_room_message_thread ON room_message (thread);
CREATE INDEX idx_room_message_send_at ON room_message (send_at);