wulf-pulse/migrations/096_pax8_daily_schedule.sql
lorentz 230296c137 feat(13-01): seed pax8-daily sync schedule via migration 096
- Idempotent INSERT ... WHERE NOT EXISTS seed of the pax8-daily row
  (cron 0 4 * * *, is_enabled false), mirroring migration 089's style
- Covers existing installs since createDefaultSchedules() only seeds
  a virgin sync_schedules table
- Applied to running dev DB and verified idempotent (second run = 0 rows)
2026-07-11 09:46:01 -04:00

13 lines
728 B
SQL

-- Migration 096: Seed the pax8-daily sync schedule.
--
-- The sync_scheduler.createDefaultSchedules() path only seeds defaults on a
-- virgin sync_schedules table; this migration covers existing installs.
-- sync_schedules has no unique constraint on name, so guard with NOT EXISTS
-- (same pattern as migration 089's appgate-sessions/appgate-daily seeds).
INSERT INTO sync_schedules (id, name, description, cron_expression, sync_type, is_enabled)
SELECT 'pax8-daily',
'PAX8 Daily Sync',
'Full PAX8 sync — companies, subscriptions, products, orders, and company matching, daily at 4 AM.',
'0 4 * * *', 'pax8-daily', false
WHERE NOT EXISTS (SELECT 1 FROM sync_schedules WHERE name = 'PAX8 Daily Sync');