[
  {
    "type": "create_table",
    "description": "Create fsPointsAuditLog table for FiveStars points posting audit trail and idempotency tracking",
    "database": "kiosk_buykiosk",
    "check_query": "SHOW TABLES LIKE 'fsPointsAuditLog'",
    "sql": "CREATE TABLE `fsPointsAuditLog` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `idempotencyKey` varchar(64) NOT NULL COMMENT 'SHA256 hex string for duplicate prevention',\n  `typeNum` varchar(10) NOT NULL COMMENT 'Store identifier',\n  `phoneHash` varchar(40) NOT NULL COMMENT 'SHA1 of phone number (FiveStars format)',\n  `date` date NOT NULL COMMENT 'Points date',\n  `points` int(11) NOT NULL COMMENT 'Points amount (can be negative for returns)',\n  `requestData` json DEFAULT NULL COMMENT 'Full request payload sent to API',\n  `responseData` json DEFAULT NULL COMMENT 'Full API response received',\n  `status` enum('success','failure') NOT NULL COMMENT 'Posting result status',\n  `errorMessage` text DEFAULT NULL COMMENT 'Error details if status is failure',\n  `createdAt` datetime NOT NULL DEFAULT current_timestamp() COMMENT 'Record creation timestamp',\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `idx_idempotency_key` (`idempotencyKey`),\n  KEY `idx_typenum_date` (`typeNum`, `date`),\n  KEY `idx_status_created` (`status`, `createdAt`),\n  KEY `idx_audit_lookup` (`typeNum`, `date`, `status`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='FiveStars points posting audit log for idempotency and reconciliation'"
  }
]
