[
  {
    "type": "create_table",
    "description": "Create scheduleTimePunches table for time clock records",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'scheduleTimePunches'",
    "sql": "CREATE TABLE `scheduleTimePunches` (\n  `punchId` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `employeeId` int(10) unsigned NOT NULL COMMENT 'FK to kiosk_users.users.id (central user ID)',\n  `shiftId` int(10) unsigned DEFAULT NULL COMMENT 'FK to scheduleShifts.shiftId (NULL for unscheduled)',\n  `punchType` enum('clockIn','clockOut','breakStart','breakEnd') NOT NULL,\n  `punchTime` datetime NOT NULL COMMENT 'Punch timestamp in UTC',\n  `breakType` enum('paid','unpaid') DEFAULT NULL COMMENT 'Only for break punches',\n  `isManualEntry` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'True if manually added by manager',\n  `manualEntryNote` text DEFAULT NULL COMMENT 'Required note for manual entries',\n  `isUnscheduled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'True if clock-in without scheduled shift',\n  `isManagerOverride` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'True if manager override was required',\n  `approvedByUserId` int(10) unsigned DEFAULT NULL COMMENT 'Manager who approved override',\n  `approved_at` timestamp NULL DEFAULT NULL COMMENT 'When override was approved',\n  `approvalNote` text DEFAULT NULL COMMENT 'Note for manager override',\n  `enteredByUserId` int(10) unsigned NOT NULL COMMENT 'User who created the punch',\n  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),\n  `edited_at` timestamp NULL DEFAULT NULL COMMENT 'When punch was last edited',\n  `editedByUserId` int(10) unsigned DEFAULT NULL COMMENT 'User who edited the punch',\n  `editNote` text DEFAULT NULL COMMENT 'Note for punch edit',\n  `deleted_at` timestamp NULL DEFAULT NULL COMMENT 'Soft delete timestamp',\n  `deletedByUserId` int(10) unsigned DEFAULT NULL COMMENT 'User who deleted the punch',\n  PRIMARY KEY (`punchId`),\n  KEY `idx_employee_time` (`employeeId`, `punchTime`),\n  KEY `idx_shift` (`shiftId`),\n  KEY `idx_punchType` (`punchType`),\n  KEY `idx_created` (`created_at`),\n  KEY `idx_deleted` (`deleted_at`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Time clock punch records for BuyerKiosk native scheduling'"
  }
]
