12 lines
584 B
SQL
12 lines
584 B
SQL
-- Posts can be hidden from timelines (profile feed as seen by others, the
|
|
-- global home feed) and from public collections by their owner. Hidden posts
|
|
-- still appear to the owner on their own profile and in private collections.
|
|
ALTER TABLE posts
|
|
ADD COLUMN IF NOT EXISTS is_hidden BOOLEAN NOT NULL DEFAULT FALSE;
|
|
|
|
-- Partial index keeps the "visible posts, newest first" timeline/feed scans
|
|
-- cheap by excluding hidden rows from the index entirely.
|
|
CREATE INDEX IF NOT EXISTS posts_user_created_visible_idx
|
|
ON posts (user_id, created_at DESC)
|
|
WHERE is_hidden = FALSE;
|