-- =====================================================================
-- Migration 007: Adds Status Column to Comments for Moderation
-- =====================================================================

-- Adds Status Column with Default 'pending'
ALTER TABLE comments
    ADD COLUMN status VARCHAR(20) NOT NULL DEFAULT 'pending'
    CHECK (status IN ('pending', 'approved', 'rejected'));

-- Index for fast Status Filtering
CREATE INDEX idx_comments_status ON comments(status);

-- Approves existing Comments
UPDATE comments SET status = 'approved';