Files
Messenger/server/internal/store/migrations/0003_reactions.sql
T

9 lines
425 B
SQL
Raw Normal View History

-- 0003_reactions.sql
CREATE TABLE IF NOT EXISTS message_reactions (
message_id BIGINT NOT NULL REFERENCES messages(id) ON DELETE CASCADE,
user_id BIGINT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
emoji TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY (message_id, user_id, emoji)
);
CREATE INDEX IF NOT EXISTS idx_reactions_message ON message_reactions(message_id);