-- Add contractors field to Projects table
-- Migration: Add contractors JSON field to Projects table
-- Date: 2026-03-14

ALTER TABLE Projects 
ADD COLUMN contractors JSON DEFAULT NULL COMMENT 'قائمة معرفات المقاولين المرتبطين بالمشروع';

-- Create index for better performance (optional)
CREATE INDEX idx_projects_contractors ON Projects ((contractors->'$[*]'));

-- Update existing projects to have empty contractors array (optional)
UPDATE Projects 
SET contractors = JSON_ARRAY() 
WHERE contractors IS NULL;
