-- Migration: Add is_pinned column to comments table
-- Migration: Add is_comments_locked column to items table
-- Run with: psql -h <host> -U <user> -d <database> -f migration_add_pinned.sql

-- Pinned comments
ALTER TABLE comments ADD COLUMN IF NOT EXISTS is_pinned BOOLEAN DEFAULT FALSE;
CREATE INDEX IF NOT EXISTS idx_comments_is_pinned ON comments(is_pinned) WHERE is_pinned = TRUE;

-- Locked threads (prevents new comments on an item)
ALTER TABLE items ADD COLUMN IF NOT EXISTS is_comments_locked BOOLEAN DEFAULT FALSE;
