-- ============================================================
-- migration_on_duty_add_time.sql
-- ============================================================
-- Adds partial-day support to On Duty requests: a "Full Day" toggle plus
-- optional from_time/to_time so an employee can apply for On Duty for
-- just part of a day (e.g. signs in at office in the morning, then goes
-- out on official work for a few hours, or vice versa).
--
-- Only run this if you already ran an earlier version of
-- migration_on_duty.sql (i.e. the on_duty_requests table already exists
-- without these columns). If you're setting up On Duty for the first
-- time, just run migration_on_duty.sql instead — it already includes
-- these columns.
--
--   mysql -u <user> -p <database_name> < migration_on_duty_add_time.sql
-- ============================================================

ALTER TABLE on_duty_requests
  ADD COLUMN is_full_day TINYINT(1) NOT NULL DEFAULT 1 AFTER to_date,
  ADD COLUMN from_time TIME NULL AFTER is_full_day,
  ADD COLUMN to_time TIME NULL AFTER from_time;
