[
  {
    "type": "create_table",
    "description": "Create hourlyStaffingMetrics table for historical data collection (Spec 026 PRD Features 11 & 12)",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'hourlyStaffingMetrics'",
    "sql": "CREATE TABLE `hourlyStaffingMetrics` (\n  `metricId` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `metricDate` date NOT NULL,\n  `hourSlot` tinyint(3) unsigned NOT NULL COMMENT '0-23, represents start of hour',\n  `staffCountTotal` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Total staff on clock',\n  `staffCountByPosition` text DEFAULT NULL COMMENT 'JSON: {cashier: 2, buyer: 3, lead: 1}',\n  `salesVolume` decimal(10,2) DEFAULT NULL COMMENT 'Sales dollar volume for hour',\n  `transactionCount` int(10) unsigned DEFAULT NULL COMMENT 'Number of transactions',\n  `buyCount` int(10) unsigned DEFAULT NULL COMMENT 'Number of buys completed',\n  `avgBuyWaitMinutes` decimal(5,2) DEFAULT NULL COMMENT 'Average buy wait time',\n  `createdAt` datetime NOT NULL DEFAULT current_timestamp(),\n  PRIMARY KEY (`metricId`),\n  UNIQUE KEY `idx_date_hour` (`metricDate`, `hourSlot`),\n  KEY `idx_date` (`metricDate`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Hourly staffing metrics - 1 year retention, 90 day backfill (Spec 026)'"
  }
]
