[
  {
    "type": "create_table",
    "description": "Create posDataResyncs table to track stale data resync requests",
    "database": "kiosk_buykiosk",
    "check_query": "SHOW TABLES LIKE 'posDataResyncs'",
    "sql": "CREATE TABLE `posDataResyncs` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `typeNum` varchar(10) NOT NULL,\n  `resyncDate` date NOT NULL,\n  `ruleId` varchar(64) NOT NULL COMMENT 'Identifies which resync rule detected this',\n  `dataType` varchar(20) NOT NULL COMMENT 'Data type to request: dailyClose, sales, buys',\n  `status` enum('detected','commanded','resolved','persistent') NOT NULL DEFAULT 'detected',\n  `commandCount` int(10) unsigned NOT NULL DEFAULT 0,\n  `lastCommandSentAt` datetime DEFAULT NULL,\n  `lastRequestId` varchar(64) DEFAULT NULL,\n  `resolvedAt` datetime DEFAULT NULL,\n  `firstDetectedAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,\n  `updatedAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `uk_store_date_rule` (`typeNum`, `resyncDate`, `ruleId`),\n  KEY `idx_status` (`status`),\n  KEY `idx_typenum_status` (`typeNum`, `status`),\n  KEY `idx_rule_status` (`ruleId`, `status`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci"
  }
]
