[
  {
    "type": "create_table",
    "description": "Create ccExportLog table to record Constant Contact contact exports (audit trail + 'since last export' support)",
    "database": "kiosk_buykiosk",
    "check_query": "SHOW TABLES LIKE 'ccExportLog'",
    "sql": "CREATE TABLE `ccExportLog` (\n  `id` INT AUTO_INCREMENT PRIMARY KEY,\n  `typeNum` VARCHAR(10) NOT NULL,\n  `userId` INT NULL COMMENT 'uf_user.id of the admin who ran the export',\n  `format` ENUM('csv','xlsx') NOT NULL,\n  `rangeType` VARCHAR(30) NOT NULL COMMENT 'today|7d|30d|90d|ytd|all|custom|sinceLastExport',\n  `rangeStart` DATETIME NULL COMMENT 'Only set for custom/sinceLastExport ranges',\n  `rangeEnd` DATETIME NULL COMMENT 'Only set for custom ranges',\n  `contactCount` INT NOT NULL DEFAULT 0,\n  `exportedAt` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n  INDEX `idx_typeNum_exportedAt` (`typeNum`, `exportedAt`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4"
  }
]
