multica/server/migrations/026_comment_reactions.up.sql
Jiayuan 7c1aabbe3a feat(reactions): add emoji reactions for comments and issue descriptions
Add Slack-style emoji reactions to comments and issue descriptions with
full-stack support: database tables, REST API endpoints, real-time
WebSocket sync, optimistic UI updates, and inbox notifications.

- New `comment_reaction` and `issue_reaction` tables with migrations
- POST/DELETE endpoints for adding/removing reactions on both comments
  and issue descriptions
- Real-time WS events (reaction:added/removed, issue_reaction:added/removed)
- Shared ReactionBar component with quick emoji picker and full emoji-mart
  picker (lazy-loaded)
- Optimistic add/remove with rollback on failure
- Inbox notifications for comment author and issue creator when reacted to
- Reactions included in timeline, comment list, and issue detail responses
2026-03-30 22:37:59 +08:00

12 lines
540 B
SQL

CREATE TABLE comment_reaction (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
comment_id UUID NOT NULL REFERENCES comment(id) ON DELETE CASCADE,
workspace_id UUID NOT NULL REFERENCES workspace(id) ON DELETE CASCADE,
actor_type TEXT NOT NULL CHECK (actor_type IN ('member', 'agent')),
actor_id UUID NOT NULL,
emoji TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
UNIQUE (comment_id, actor_type, actor_id, emoji)
);
CREATE INDEX idx_comment_reaction_comment_id ON comment_reaction(comment_id);