diff --git a/apps/desktop/src-tauri/Cargo.toml b/apps/desktop/src-tauri/Cargo.toml index 50e43aa..7394dc2 100644 --- a/apps/desktop/src-tauri/Cargo.toml +++ b/apps/desktop/src-tauri/Cargo.toml @@ -4,6 +4,7 @@ version = "0.2.1" description = "MixVideo Desktop Application" authors = ["imeepos "] edition = "2021" +default-run = "mixvideo-desktop" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/apps/desktop/src-tauri/src/bin/check_db.rs b/apps/desktop/src-tauri/src/bin/check_db.rs new file mode 100644 index 0000000..ac90ce0 --- /dev/null +++ b/apps/desktop/src-tauri/src/bin/check_db.rs @@ -0,0 +1,66 @@ +use rusqlite::{Connection, Result}; +use std::path::PathBuf; + +fn main() -> Result<()> { + // 获取数据库路径 + let app_data_dir = dirs::data_dir() + .expect("无法获取应用数据目录") + .join("mixvideo"); + + let db_path = app_data_dir.join("mixvideoV2.db"); + + println!("数据库路径: {}", db_path.display()); + + if !db_path.exists() { + println!("数据库文件不存在"); + return Ok(()); + } + + // 连接数据库 + let conn = Connection::open(&db_path)?; + + // 检查 outfit_image_records 表结构 + println!("\n=== outfit_image_records 表结构 ==="); + let mut stmt = conn.prepare("PRAGMA table_info(outfit_image_records)")?; + let rows = stmt.query_map([], |row| { + Ok(( + row.get::<_, i32>(0)?, // cid + row.get::<_, String>(1)?, // name + row.get::<_, String>(2)?, // type + row.get::<_, i32>(3)?, // notnull + row.get::<_, Option>(4)?, // dflt_value + row.get::<_, i32>(5)?, // pk + )) + })?; + + for row in rows { + let (cid, name, type_, notnull, dflt_value, pk) = row?; + println!("{}: {} {} {} {} {}", cid, name, type_, notnull, dflt_value.unwrap_or("NULL".to_string()), pk); + } + + // 检查迁移历史 + println!("\n=== 迁移历史 ==="); + let mut stmt = conn.prepare("SELECT version, description, applied_at, success FROM schema_migrations ORDER BY version")?; + let rows = stmt.query_map([], |row| { + Ok(( + row.get::<_, u32>(0)?, // version + row.get::<_, String>(1)?, // description + row.get::<_, String>(2)?, // applied_at + row.get::<_, i32>(3)?, // success + )) + })?; + + for row in rows { + let (version, description, applied_at, success) = row?; + println!("v{}: {} - {} (成功: {})", version, description, applied_at, success == 1); + } + + // 检查是否有 comfyui_prompt_id 字段 + println!("\n=== 检查 comfyui_prompt_id 字段 ==="); + match conn.prepare("SELECT comfyui_prompt_id FROM outfit_image_records LIMIT 1") { + Ok(_) => println!("✅ comfyui_prompt_id 字段存在"), + Err(e) => println!("❌ comfyui_prompt_id 字段不存在: {}", e), + } + + Ok(()) +} diff --git a/apps/desktop/src-tauri/src/infrastructure/database/migrations.rs b/apps/desktop/src-tauri/src/infrastructure/database/migrations.rs index 99653ad..c82c1da 100644 --- a/apps/desktop/src-tauri/src/infrastructure/database/migrations.rs +++ b/apps/desktop/src-tauri/src/infrastructure/database/migrations.rs @@ -262,9 +262,9 @@ impl MigrationManager { down_sql: Some(include_str!("migrations/027_create_video_generation_records_table_down.sql").to_string()), }); - // 迁移 28: 添加 ComfyUI prompt_id 字段到穿搭图片生成记录表 + // 迁移 29: 添加 ComfyUI prompt_id 字段到穿搭图片生成记录表 self.add_migration(Migration { - version: 28, + version: 29, description: "添加 ComfyUI prompt_id 字段到穿搭图片生成记录表".to_string(), up_sql: include_str!("migrations/028_add_comfyui_prompt_id_to_outfit_image_records.sql").to_string(), down_sql: None, // 暂时不提供回滚脚本