-- Migration: Add is_processed field to exhibitions table
-- Description: Mark exhibitions as processed to prevent duplicate revenue record generation
-- Date: 2026-05-19

ALTER TABLE exhibitions ADD COLUMN IF NOT EXISTS is_processed BOOLEAN DEFAULT false;

-- Create index for faster queries on unprocessed expired exhibitions
CREATE INDEX IF NOT EXISTS idx_exhibitions_unprocessed ON exhibitions(expire_at) WHERE is_processed = false AND deleted_at IS NULL;