Files
cannaiq/backend/migrations/121_schedule_interval_minutes.sql
Kelly b607fd7f44 feat(scheduler): Support sub-hour interval_minutes in task_schedules
- Add interval_minutes column to TaskSchedule interface
- Prefer interval_minutes over interval_hours when calculating next_run_at
- Add jitter (0-20% of interval) for sub-hour schedules to prevent detection
- Update getSchedules() to include interval_minutes and dispensary_name
- Update updateSchedule() to allow setting interval_minutes
- Add migration 121 for interval_minutes column

Part of Real-Time Inventory Tracking feature.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 18:22:55 -07:00

16 lines
735 B
SQL

-- 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;