[
  {
    "type": "create_table",
    "description": "Create scheduleOvertimeAlerts dedupe-state table (central kiosk_users) for the approaching-overtime push alerts. One row per (typeNum, employeeId, weekStart) tracks the last status that was notified so the OvertimeAlertJob only pushes to managers/owners on an ESCALATION (ok->approaching, approaching->breach, ok->breach) instead of every run. lastStatus is updated even on de-escalation so a later re-climb fires again.",
    "database": "kiosk_users",
    "check_query": "SHOW TABLES LIKE 'scheduleOvertimeAlerts'",
    "sql": "CREATE TABLE `scheduleOvertimeAlerts` (\n  `alertId` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `typeNum` varchar(10) NOT NULL COMMENT 'Store identifier',\n  `employeeId` int(10) unsigned NOT NULL COMMENT 'FK to users.id',\n  `weekStart` date NOT NULL COMMENT 'Local week start (store work-week start day)',\n  `lastStatus` varchar(16) NOT NULL DEFAULT 'ok' COMMENT 'ok | approaching | breach as of last evaluation',\n  `lastProjectedHours` decimal(6,2) NOT NULL DEFAULT 0.00 COMMENT 'Projected weekly hours at last evaluation',\n  `thresholdHours` decimal(6,2) NOT NULL DEFAULT 0.00 COMMENT 'Store OT threshold at last evaluation',\n  `lastNotifiedAt` datetime DEFAULT NULL COMMENT 'When the last escalation push was queued (NULL = never notified)',\n  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),\n  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),\n  PRIMARY KEY (`alertId`),\n  UNIQUE KEY `uk_store_emp_week` (`typeNum`, `employeeId`, `weekStart`),\n  KEY `idx_store_week` (`typeNum`, `weekStart`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Dedupe state for approaching-overtime push alerts'"
  }
]
