-- Migration: 00009_add_review_flags
-- Description: Add Red/Green flag system to reviews (Tea-style)
-- Author: Auto-generated
-- Date: 2025-12-16

-- ============================================
-- REVIEW FLAG ENUM
-- ============================================
-- Overall "vibe" classification for a review.
DO $$
BEGIN
  CREATE TYPE review_flag AS ENUM ('green', 'red');
EXCEPTION
  WHEN duplicate_object THEN NULL;
END $$;

-- ============================================
-- REVIEWS TABLE UPDATE
-- ============================================
ALTER TABLE reviews
  ADD COLUMN IF NOT EXISTS flag review_flag;

COMMENT ON COLUMN reviews.flag IS 'Red/Green flag for the overall vibe of the review (Tea-style)';

-- Optional index for filtering
CREATE INDEX IF NOT EXISTS idx_reviews_flag ON reviews(flag) WHERE flag IS NOT NULL;

