[
  {
    "type": "insert",
    "description": "Register the QuickBooksStuckPostingRecoveryJob TaskEngine job. Companion to PR5's race-condition guard in JournalEntryService::postStagedEntry(): if the worker that claimed a row dies between the CAS UPDATE (status='posting') and the success/failure transition (posted/pending_approval), the row is stuck forever. This job sweeps stuck rows every 10 minutes per store, queries QBO via DocNumber to determine truth, and either finalizes (Add succeeded — status='posted', journalEntryId set) or reverts (status='pending_approval' for re-approval). Idempotent and safe on a tight cadence.",
    "database": "kiosk_buykiosk",
    "check_query": "SELECT 1 FROM task_job_definitions WHERE name = 'quickbooks-stuck-posting-recovery'",
    "sql": "INSERT IGNORE INTO `task_job_definitions` (`name`, `displayName`, `className`, `schedule`, `queue`, `scope`, `timeout`, `maxRetries`, `retryBackoff`, `config`, `isEnabled`, `notifyOnFailure`, `notifyEmails`) VALUES ('quickbooks-stuck-posting-recovery', 'QuickBooks Stuck Posting Recovery', 'BuyerKiosk\\\\TaskEngine\\\\Jobs\\\\QuickBooksStuckPostingRecoveryJob', '*/10 * * * *', 'default', 'per_store', 60, 2, 30, '{\"stuckMinutes\": 10}', 1, 1, NULL)"
  }
]
