[
  {
    "type": "alter_table",
    "description": "Add buyQueue.drsState + drsStateTime. Records the status DRS/POS reported for a buy that was NOT yet processed (offer-entered) in the kiosk, WITHOUT force-completing it. Previously syncFinalizedBuys force-set isProcessed=1 on paid/quote/voided, pulling un-processed buys into the completed grid with no buyer and no pickup SMS ('buys processed on their own' complaints). Now an unprocessed buy is flagged here and LEFT in the active queue so the employee completes it normally (which sends the text). NULL = no DRS finalize seen while unprocessed.",
    "database": "{{store}}",
    "check_query": "SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'buyQueue' AND COLUMN_NAME = 'drsState'",
    "sql": "ALTER TABLE `buyQueue` ADD COLUMN `drsState` ENUM('paid','quote','voided') NULL DEFAULT NULL COMMENT 'DRS/POS-reported status for a buy not yet processed in the kiosk; buy stays in the active queue. NULL = none.' AFTER `checkoutStatus`, ADD COLUMN `drsStateTime` DATETIME NULL DEFAULT NULL COMMENT 'When drsState was last set by syncFinalizedBuys.' AFTER `drsState`"
  }
]
