-- Migration: Add operation admin fields
-- Date: 2025-12-30
-- Description: Adds new columns to operations table for admin panel management

-- Add passing_grade column (minimum grade to pass, default 60)
ALTER TABLE operations ADD COLUMN IF NOT EXISTS passing_grade INT DEFAULT 60;

-- Add time_limit_hours column (optional time limit for operation)
ALTER TABLE operations ADD COLUMN IF NOT EXISTS time_limit_hours INT DEFAULT NULL;

-- Add scenario_prompt column (AI generation prompt)
ALTER TABLE operations ADD COLUMN IF NOT EXISTS scenario_prompt TEXT DEFAULT NULL;

-- Add tags column (JSON array for categorization)
ALTER TABLE operations ADD COLUMN IF NOT EXISTS tags JSON DEFAULT NULL;

-- Add is_premium column (0 = free, 1 = premium only)
ALTER TABLE operations ADD COLUMN IF NOT EXISTS is_premium TINYINT(1) DEFAULT 1;

-- Note: MySQL 5.7+ supports IF NOT EXISTS for ALTER TABLE ADD COLUMN
-- If using older MySQL, remove "IF NOT EXISTS" and run each ALTER separately, catching errors for existing columns
