feat(260521-fci-02): wire tickets-reconcile schedule + migration 090

- sync-scheduler.ts: extend sync_type union with 'tickets-reconcile', add a
  default schedule entry (disabled, 30 4 * * *), and a dispatch case using
  the device-link-reconcile / integration-health dynamic-import pattern.
- migrations/090_ticket_reconcile_schedule.sql: idempotent INSERT (ON CONFLICT
  DO NOTHING) so existing installs pick up the row without disturbing the
  fresh-DB default-seed path.
This commit is contained in:
lorentz 2026-05-21 11:09:36 -04:00
parent 51f0b32cb3
commit badd718194
2 changed files with 52 additions and 1 deletions

View file

@ -0,0 +1,24 @@
-- Migration 090: Seed the tickets-reconcile sync schedule (STOPGAP).
--
-- The sync_scheduler.createDefaultSchedules() path only seeds defaults on a
-- virgin sync_schedules table; this migration covers existing installs.
-- Idempotent via ON CONFLICT (id) DO NOTHING.
INSERT INTO sync_schedules (
id,
name,
description,
cron_expression,
sync_type,
years_back,
is_enabled
) VALUES (
'tickets-reconcile',
'Tickets Reconciliation',
'STOPGAP backstop: re-fetches stale-open tickets (>7d since last sync) from Autotask and reconciles status / soft-deletes missing rows. Runs daily at 4:30 AM. Capped at 500 tickets per run.',
'30 4 * * *',
'tickets-reconcile',
NULL,
false
)
ON CONFLICT (id) DO NOTHING;