[
  {
    "type": "create_table",
    "description": "Create workbook_task_day_overrides table for per-day task assignment overrides",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'workbook_task_day_overrides'",
    "sql": "CREATE TABLE `workbook_task_day_overrides` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `targetType` enum('task','group') NOT NULL COMMENT 'Whether this overrides a task or a task group',\n  `targetId` int(10) unsigned NOT NULL COMMENT 'FK to tasks.id or taskGroups.id',\n  `assignmentType` enum('position','person') NOT NULL COMMENT 'Type of override: position or person',\n  `positionId` int(10) unsigned DEFAULT NULL COMMENT 'FK to schedulePositions.positionId when assignmentType=position',\n  `userId` int(11) DEFAULT NULL COMMENT 'FK to kiosk_users.users.id when assignmentType=person',\n  `date` date NOT NULL COMMENT 'The specific date this override applies to',\n  `shiftId` int(10) unsigned DEFAULT NULL COMMENT 'FK to scheduleShifts.shiftId if assigned via shift dialog',\n  `createdAt` timestamp NOT NULL DEFAULT current_timestamp(),\n  `createdByUserId` int(11) unsigned NOT NULL COMMENT 'FK to kiosk_users.users.id',\n  `updatedAt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `uk_target_date` (`targetType`, `targetId`, `date`),\n  KEY `idx_date` (`date`),\n  KEY `idx_shiftId` (`shiftId`),\n  KEY `idx_userId` (`userId`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Per-day overrides for task and group assignments - expire at end of day'"
  }
]
