[
  {
    "type": "create_table",
    "description": "Create scheduleAvailability table for recurring employee availability patterns",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'scheduleAvailability'",
    "sql": "CREATE TABLE `scheduleAvailability` (\n  `availabilityId` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `employeeId` int(10) unsigned NOT NULL COMMENT 'FK to employees.employeeId',\n  `dayOfWeek` tinyint(1) unsigned NOT NULL COMMENT '0=Sunday through 6=Saturday',\n  `startTime` time NULL COMMENT 'Available from (NULL = unavailable all day)',\n  `endTime` time NULL COMMENT 'Available until',\n  `isPreferred` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Employee prefers to work this time',\n  `effectiveFrom` date NOT NULL COMMENT 'When this availability pattern starts',\n  `effectiveUntil` date NULL COMMENT 'When pattern ends (NULL = indefinite)',\n  `createdAt` timestamp NOT NULL DEFAULT current_timestamp(),\n  `updatedAt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),\n  PRIMARY KEY (`availabilityId`),\n  UNIQUE KEY `uk_employee_day_effective` (`employeeId`, `dayOfWeek`, `effectiveFrom`),\n  KEY `idx_employeeId` (`employeeId`),\n  KEY `idx_effective` (`effectiveFrom`, `effectiveUntil`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Recurring weekly availability patterns for employees'"
  }
]
