-- Migration 121: Add interval_minutes to task_schedules for sub-hour scheduling
-- Part of Real-Time Inventory Tracking feature
-- Created: 2024-12-14

-- Add interval_minutes column for sub-hour scheduling (15min, 30min, etc.)
-- When set, takes precedence over interval_hours
ALTER TABLE task_schedules ADD COLUMN IF NOT EXISTS interval_minutes INT DEFAULT NULL;

-- Add comment for documentation
COMMENT ON COLUMN task_schedules.interval_minutes IS 'Sub-hour scheduling interval in minutes (takes precedence over interval_hours when set)';

-- Create index for finding schedules by interval type
CREATE INDEX IF NOT EXISTS idx_task_schedules_interval_minutes
ON task_schedules(interval_minutes)
WHERE interval_minutes IS NOT NULL;
