-- 扩展 materials 表:新增 material_type 和 processed_content 字段,更新 status CHECK 约束以支持处理流水线状态 CREATE TABLE `materials_new` ( `id` text PRIMARY KEY NOT NULL, `project_id` text NOT NULL, `associated_date` text NOT NULL, `description` text NOT NULL, `material_type` text NOT NULL DEFAULT 'general' CHECK (`material_type` IN ('general', 'meeting')), `processed_content` text, `status` text NOT NULL DEFAULT 'pending' CHECK (`status` IN ('pending', 'processing', 'review', 'approved', 'discarded', 'failed')), `created_at` text NOT NULL, `updated_at` text NOT NULL, `deleted_at` text, FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE no action ); --> statement-breakpoint INSERT INTO `materials_new` (`id`, `project_id`, `associated_date`, `description`, `material_type`, `processed_content`, `status`, `created_at`, `updated_at`, `deleted_at`) SELECT `id`, `project_id`, `associated_date`, `description`, 'general', NULL, `status`, `created_at`, `updated_at`, `deleted_at` FROM `materials`; --> statement-breakpoint DROP TABLE `materials`; --> statement-breakpoint ALTER TABLE `materials_new` RENAME TO `materials`; --> statement-breakpoint CREATE INDEX `materials_project_id_idx` ON `materials` (`project_id`);