CREATE TABLE IF NOT EXISTS post_reactions ( user_id UUID NOT NULL REFERENCES profiles(id) ON DELETE CASCADE, post_id UUID NOT NULL REFERENCES posts(id) ON DELETE CASCADE, emoji TEXT NOT NULL, created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), PRIMARY KEY (user_id, post_id, emoji) ); CREATE INDEX IF NOT EXISTS idx_post_reactions_post_id ON post_reactions(post_id);