[
  {
    "type": "create_table",
    "description": "Create scheduleTemplateShifts table for storing template shift definitions",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'scheduleTemplateShifts'",
    "sql": "CREATE TABLE `scheduleTemplateShifts` (\n  `templateShiftId` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `templateId` int(10) unsigned NOT NULL COMMENT 'FK to scheduleTemplates.templateId',\n  `dayOfWeek` tinyint unsigned NOT NULL COMMENT 'Day of week (0=Sunday, 6=Saturday)',\n  `startTime` time NOT NULL COMMENT 'Shift start time (HH:MM:SS)',\n  `endTime` time NOT NULL COMMENT 'Shift end time (HH:MM:SS)',\n  `employeeId` int(10) unsigned DEFAULT NULL COMMENT 'FK to kiosk_users.users.id (NULL = open shift)',\n  `positionId` int(10) unsigned DEFAULT NULL COMMENT 'FK to schedulePositions.positionId',\n  `minRoleId` tinyint unsigned DEFAULT NULL COMMENT 'Minimum role level for this shift',\n  `notes` text DEFAULT NULL COMMENT 'Optional shift notes',\n  PRIMARY KEY (`templateShiftId`),\n  KEY `idx_template` (`templateId`),\n  KEY `idx_day` (`dayOfWeek`),\n  CONSTRAINT `fk_template_shifts_template` FOREIGN KEY (`templateId`) REFERENCES `scheduleTemplates` (`templateId`) ON DELETE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Shift definitions within schedule templates'"
  }
]
