-- =============================================================================
-- 15-leave-type-day-off.sql
-- Migration: LeaveTypeDayOff1781040000000
-- Run AFTER 09-leave-document.sql (or any later script)
-- Requires: 00b-cpanel-helpers.sql (for cp_safe_exec)
--
-- SAFE: extends leaves.leave_type enum only — does not change existing rows.
-- Re-run safe: MODIFY with day_off already present is a no-op at the data level.
-- =============================================================================

CALL cp_safe_exec('ALTER TABLE `leaves` MODIFY COLUMN `leave_type` enum (''annual'',''sick'',''casual'',''maternity'',''paternity'',''personal'',''compensatory'',''unpaid'',''day_off'') NOT NULL DEFAULT ''annual''');

INSERT INTO migrations (timestamp, name)
SELECT 1781040000000, 'LeaveTypeDayOff1781040000000'
WHERE NOT EXISTS (
  SELECT 1 FROM migrations WHERE name = 'LeaveTypeDayOff1781040000000'
);

SHOW COLUMNS FROM `leaves` LIKE 'leave_type';
