USE db_abos_v0.1;

-- Adds fact_hr_events.notes — the new HR Events backend module (HrEventService/HrEventController)
-- stores the frontend's "purpose" and "notes" fields separately, but the table only had a single
-- `description` column. Guarded so it's safe to re-run.

SET @col_exists = (SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'fact_hr_events' AND COLUMN_NAME = 'notes');
SET @sql = IF(@col_exists = 0, 'ALTER TABLE `fact_hr_events` ADD COLUMN `notes` tinytext AFTER `description`', 'SELECT 1');
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
