-- Migration: Add show_results field to projects table
-- Date: 2025-10-09
-- Description: Adds an ENUM field to control how survey results are displayed/sent

USE survey_manager;

-- Add show_results column to projects table
ALTER TABLE projects
ADD COLUMN show_results ENUM('after_end_survey', 'send_by_email', 'show_by_admin')
DEFAULT 'show_by_admin'
AFTER end_date;

-- Update existing projects to have default value
UPDATE projects SET show_results = 'show_by_admin' WHERE show_results IS NULL;
