- Replace NULLIF with CASE WHEN for proper UUID casting - Fix missing ::uuid casting in WHERE clauses - Resolve 'operator does not exist: uuid = text' errors - Focus on post_repository.go, notification_repository.go, and category_repository.go
10 lines
383 B
SQL
10 lines
383 B
SQL
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);
|