[
  {
    "type": "create_table",
    "description": "Create scheduleTimePunchAudit table for time punch change history",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'scheduleTimePunchAudit'",
    "sql": "CREATE TABLE `scheduleTimePunchAudit` (\n  `auditId` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `punchId` int(10) unsigned NOT NULL COMMENT 'FK to scheduleTimePunches.punchId',\n  `action` enum('create','update','delete') NOT NULL,\n  `actorUserId` int(10) unsigned NOT NULL COMMENT 'User who made the change',\n  `occurredAt` datetime NOT NULL COMMENT 'When change occurred (UTC)',\n  `oldValueJson` text DEFAULT NULL COMMENT 'Previous values as JSON',\n  `newValueJson` text DEFAULT NULL COMMENT 'New values as JSON',\n  `note` text DEFAULT NULL COMMENT 'Required note for punch edits',\n  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),\n  PRIMARY KEY (`auditId`),\n  KEY `idx_punch_occurred` (`punchId`, `occurredAt`),\n  KEY `idx_actor` (`actorUserId`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Audit trail for time punch changes'"
  }
]
