-- Migration: Change assignee field to support multiple assignees
-- Date: 2025-01-XX
-- Description: Changes assignee field from VARCHAR(255) to JSON to support multiple assignees as JSON array

-- ===== Change assignee field to JSON =====
-- First, convert existing single assignee values to JSON array format
UPDATE project_tasks 
SET assignee = CASE 
  WHEN assignee IS NULL OR assignee = '' THEN NULL
  ELSE JSON_ARRAY(assignee)
END
WHERE assignee IS NOT NULL AND assignee != '';

-- Change column type to JSON
ALTER TABLE project_tasks 
MODIFY COLUMN assignee JSON DEFAULT NULL COMMENT '担当者（JSON配列形式）';

-- Update task_delay_alerts table assignee field as well if it exists
-- Note: This table might have assignee field, but we'll keep it as VARCHAR for now
-- since it's used for display purposes in alerts

