featured_posts
Overview
The featured_posts table tracks which posts a user has pinned to their HomeRoom. Featured posts appear in a dedicated module and have a position ordering. This lets users curate a highlight reel of their best content.
Relevant Invariants
- Invariant #10: "Expressive Freedom Is Spatially Contained" -- Featured posts are a HomeRoom customization
Schema
-- From 20260130_homeroom_foundation.sql
CREATE TABLE featured_posts (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL REFERENCES auth.users(id) ON DELETE CASCADE,
post_id UUID NOT NULL REFERENCES posts(id) ON DELETE CASCADE,
position INTEGER DEFAULT 0,
created_at TIMESTAMPTZ DEFAULT NOW(),
UNIQUE(user_id, post_id)
);
Columns
| Column | Type | Nullable | Default | Description |
|---|---|---|---|---|
id | uuid | No | gen_random_uuid() | Primary key |
user_id | uuid | No | -- | HomeRoom owner |
post_id | uuid | No | -- | Featured post (cascades on delete) |
position | integer | No | 0 | Display order |
created_at | timestamptz | No | NOW() | When post was featured |
RLS Policies
-- SELECT: Anyone can view featured posts (HomeRooms are visitable)
CREATE POLICY "Featured posts are publicly viewable"
ON featured_posts FOR SELECT
USING (true);
-- INSERT/DELETE: Users manage their own featured posts
CREATE POLICY "Users can manage own featured posts"
ON featured_posts FOR ALL
USING (auth.uid() = user_id);
Related
- posts -- The featured post
- home_room_settings -- Room where featured posts appear
- profiles -- Room owner
Last updated: 2026-02-07