-- Add human review functionality to toxicity scores
-- Migration to add human_reviewed, review_status, and reviewed_at columns

-- Add columns to toxicity_scores (for posts)
ALTER TABLE toxicity_scores
ADD COLUMN IF NOT EXISTS human_reviewed BOOLEAN DEFAULT FALSE,
ADD COLUMN IF NOT EXISTS review_status VARCHAR(20) DEFAULT NULL, -- 'correct', 'incorrect', 'unsure'
ADD COLUMN IF NOT EXISTS reviewed_at TIMESTAMP DEFAULT NULL;

-- Add columns to mention_toxicity_scores (for mentions)
ALTER TABLE mention_toxicity_scores
ADD COLUMN IF NOT EXISTS human_reviewed BOOLEAN DEFAULT FALSE,
ADD COLUMN IF NOT EXISTS review_status VARCHAR(20) DEFAULT NULL, -- 'correct', 'incorrect', 'unsure'
ADD COLUMN IF NOT EXISTS reviewed_at TIMESTAMP DEFAULT NULL;

-- Create indexes for filtering
CREATE INDEX IF NOT EXISTS idx_toxicity_scores_human_reviewed ON toxicity_scores (human_reviewed);
CREATE INDEX IF NOT EXISTS idx_toxicity_scores_review_status ON toxicity_scores (review_status);
CREATE INDEX IF NOT EXISTS idx_mention_toxicity_scores_human_reviewed ON mention_toxicity_scores (human_reviewed);
CREATE INDEX IF NOT EXISTS idx_mention_toxicity_scores_review_status ON mention_toxicity_scores (review_status);
