[
  {
    "type": "create_table",
    "description": "Create scheduleAuditLog table for comprehensive scheduling action audit trail",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'scheduleAuditLog'",
    "sql": "CREATE TABLE `scheduleAuditLog` (\n  `auditId` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `action` varchar(50) NOT NULL COMMENT 'Action: clock_in, clock_out, shift_swap, time_off_approve, etc.',\n  `entityType` varchar(50) NOT NULL COMMENT 'Entity: shift, time_punch, swap_request, time_off_request, etc.',\n  `entityId` int(10) unsigned NOT NULL COMMENT 'ID of the affected entity',\n  `employeeId` int(10) unsigned NULL COMMENT 'Employee affected by the action',\n  `actorUserId` int(10) unsigned NOT NULL COMMENT 'User who performed the action',\n  `actorType` enum('employee','manager','system') NOT NULL COMMENT 'Type of actor',\n  `previousValue` json NULL COMMENT 'State before the change',\n  `newValue` json NULL COMMENT 'State after the change',\n  `metadata` json NULL COMMENT 'Additional context: GPS coords, device info, etc.',\n  `ipAddress` varchar(45) NULL COMMENT 'IP address of the request',\n  `userAgent` varchar(255) NULL COMMENT 'User agent string',\n  `createdAt` timestamp NOT NULL DEFAULT current_timestamp(),\n  PRIMARY KEY (`auditId`),\n  KEY `idx_employee_created` (`employeeId`, `createdAt`),\n  KEY `idx_action_created` (`action`, `createdAt`),\n  KEY `idx_entity` (`entityType`, `entityId`),\n  KEY `idx_createdAt` (`createdAt`),\n  KEY `idx_actorUserId` (`actorUserId`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Audit trail for all scheduling-related actions'"
  }
]
