[
  {
    "type": "create_table",
    "description": "Create scheduleSwapRequests table for shift swap workflow between employees",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'scheduleSwapRequests'",
    "sql": "CREATE TABLE `scheduleSwapRequests` (\n  `swapId` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `initiatorEmployeeId` int(10) unsigned NOT NULL COMMENT 'Employee requesting the swap',\n  `initiatorShiftId` int(10) unsigned NOT NULL COMMENT 'Shift being offered by initiator',\n  `targetEmployeeId` int(10) unsigned NOT NULL COMMENT 'Employee being asked to swap',\n  `targetShiftId` int(10) unsigned NOT NULL COMMENT 'Shift being requested from target',\n  `status` enum('pending_coworker','pending_manager','approved','denied','cancelled','expired') NOT NULL DEFAULT 'pending_coworker' COMMENT 'Swap request status',\n  `coworkerRespondedAt` timestamp NULL COMMENT 'When coworker responded',\n  `coworkerAccepted` tinyint(1) NULL COMMENT 'Whether coworker accepted',\n  `managerReviewedByUserId` int(10) unsigned NULL COMMENT 'Manager who reviewed',\n  `managerReviewedAt` timestamp NULL COMMENT 'When manager reviewed',\n  `managerNote` text NULL COMMENT 'Manager note on decision',\n  `createdAt` timestamp NOT NULL DEFAULT current_timestamp(),\n  `expiresAt` timestamp NOT NULL COMMENT '48h for coworker response, 72h for manager',\n  PRIMARY KEY (`swapId`),\n  KEY `idx_initiator_status` (`initiatorEmployeeId`, `status`),\n  KEY `idx_target_status` (`targetEmployeeId`, `status`),\n  KEY `idx_status` (`status`),\n  KEY `idx_expiresAt` (`expiresAt`),\n  KEY `idx_initiatorShiftId` (`initiatorShiftId`),\n  KEY `idx_targetShiftId` (`targetShiftId`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Shift swap requests with coworker and manager approval workflow'"
  }
]
