- 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.
24 lines
730 B
SQL
24 lines
730 B
SQL
-- 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;
|