[
  {
    "type": "create_table",
    "description": "Create aiScheduleJobs table for async job tracking (Spec 026)",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'aiScheduleJobs'",
    "sql": "CREATE TABLE `aiScheduleJobs` (\n  `jobId` varchar(36) NOT NULL COMMENT 'UUID primary key',\n  `weekStart` date NOT NULL,\n  `status` enum('pending','processing','completed','failed') NOT NULL DEFAULT 'pending',\n  `createdByUserId` int(10) unsigned NOT NULL,\n  `createdAt` datetime NOT NULL DEFAULT current_timestamp(),\n  `startedAt` datetime DEFAULT NULL,\n  `completedAt` datetime DEFAULT NULL,\n  `optimizationPriorities` text NOT NULL COMMENT 'JSON array of priority strings',\n  `customInstructions` text DEFAULT NULL,\n  `includeOwnerIds` text DEFAULT NULL COMMENT 'JSON array of owner user IDs',\n  `notifyByEmail` tinyint(1) NOT NULL DEFAULT 0,\n  `errorMessage` text DEFAULT NULL,\n  `suggestionId` int(10) unsigned DEFAULT NULL COMMENT 'FK to aiScheduleSuggestions when complete',\n  PRIMARY KEY (`jobId`),\n  KEY `idx_week_status` (`weekStart`, `status`),\n  KEY `idx_created` (`createdAt`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='AI schedule generation jobs (Spec 026)'"
  }
]
