diff --git a/backend/prisma/migrations/20260516_enable_community_posts_realtime/migration.sql b/backend/prisma/migrations/20260516_enable_community_posts_realtime/migration.sql new file mode 100644 index 0000000..f6f7d70 --- /dev/null +++ b/backend/prisma/migrations/20260516_enable_community_posts_realtime/migration.sql @@ -0,0 +1,15 @@ +-- Enable Supabase Realtime for rebreak.community_posts. +-- +-- Why: foreign-like counts never updated in the feed because the table was +-- never in the supabase_realtime publication. useCommunityRealtime hooks +-- listen for UPDATE on community_posts (likes_count, dislikes_count, +-- comments_count, reposts_count) and patch the React-Query cache so visible +-- PostCards re-render with the new count. Without the publication entry the +-- whole channel is silent — users only ever saw the notifications channel +-- fire (rebreak.notifications was added in 20260511) and assumed realtime +-- was working end to end. It wasn't, for posts. +-- +-- After deploy, the count on a PostCard should reflect a foreign user's like +-- within ~200ms of the API write, without pull-to-refresh. + +ALTER PUBLICATION supabase_realtime ADD TABLE rebreak.community_posts;