-- Migration script to add concern-related fields to appointments table
-- Run these ALTER TABLE statements to add the new fields

-- Add concern_primary_id field
ALTER TABLE appointments 
ADD COLUMN concern_primary_id VARCHAR(50) DEFAULT '0' COMMENT 'Primary concern ID reference';

-- Add concern_detail_selected_id field  
ALTER TABLE appointments 
ADD COLUMN concern_detail_selected_id VARCHAR(50) DEFAULT '0' COMMENT 'Detailed concern selection ID reference';

-- Add other_primary field for custom primary concerns
ALTER TABLE appointments 
ADD COLUMN other_primary VARCHAR(255) DEFAULT NULL COMMENT 'Custom primary concern text';

-- Add concern_seconday_id field (note: maintaining original typo as per request)
ALTER TABLE appointments 
ADD COLUMN concern_seconday_id VARCHAR(50) DEFAULT '0' COMMENT 'Secondary concern ID reference';

-- Optional: Add indexes for better query performance
CREATE INDEX idx_appointments_concern_primary ON appointments(concern_primary_id);
CREATE INDEX idx_appointments_concern_detail ON appointments(concern_detail_selected_id);
CREATE INDEX idx_appointments_concern_secondary ON appointments(concern_seconday_id);

-- Verify the changes
DESCRIBE appointments;
