[
  {
    "type": "alter_table",
    "description": "Extend buyQueue.checkoutStatus ENUM to add 'stranded'. StrandedBuyCleanupJob previously marked processed-but-never-cashed-out buys as 'voided' (a POS no-buy), wrongly telling staff the customer was turned away. 'stranded' is a distinct terminal state: auto-closed overnight, still owed a payout, stays in the completed-grid cash-out workflow. Additive ENUM change — cannot affect existing 'paid'/'voided' rows.",
    "database": "{{store}}",
    "check_query": "SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'buyQueue' AND COLUMN_NAME = 'checkoutStatus' AND COLUMN_TYPE LIKE '%stranded%'",
    "sql": "ALTER TABLE `buyQueue` MODIFY COLUMN `checkoutStatus` ENUM('paid','voided','stranded') NULL DEFAULT NULL COMMENT 'Set when checkedOut=1: paid = customer accepted and paid out; voided = POS no-buy (customer must return for items); stranded = auto-closed overnight, processed but never cashed out (pending payout). NULL while still active.'"
  },
  {
    "type": "update",
    "description": "Move StrandedBuyCleanupJob off its old 59 23 * * * (23:59 UTC) schedule, which the scheduler evaluates in UTC and therefore fired at ~5 PM Pacific / ~8 PM Eastern — during business hours — auto-closing live in-progress buys. 08:00 UTC (0 8 * * *) is overnight (~12 AM–4 AM) for every North American store timezone: after close, before the next business day. Must stay overnight-for-all-zones; do not move into business hours.",
    "database": "kiosk_buykiosk",
    "sql": "UPDATE `task_job_definitions` SET `schedule` = '0 8 * * *' WHERE `name` = 'queue:stranded-buy-cleanup'"
  }
]
