[
  {
    "type": "create_table",
    "description": "Create workbook_task_position_assignments table for recurring position-based task assignments",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'workbook_task_position_assignments'",
    "sql": "CREATE TABLE `workbook_task_position_assignments` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `targetType` enum('task','group') NOT NULL COMMENT 'Whether this assigns a task or a task group',\n  `targetId` int(10) unsigned NOT NULL COMMENT 'FK to tasks.id or taskGroups.id',\n  `positionId` int(10) unsigned NOT NULL COMMENT 'FK to schedulePositions.positionId',\n  `sortOrder` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'For multi-position, first by sortOrder is primary',\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_position` (`targetType`, `targetId`, `positionId`),\n  KEY `idx_target` (`targetType`, `targetId`),\n  KEY `idx_positionId` (`positionId`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Recurring position-based default assignments for tasks and task groups'"
  }
]
