release: v1.3.1 - Pipeline Queue Integration, OCR Fix, Worker Compatibility
Major Changes: - Pipeline Queue integration completed (internal.file + pipeline.commands) - Fixed old job_worker database compatibility with new command_queue table - Compiled Swift OCR binary (was missing, causing empty OCR results) - Added deep scan functionality through re-scan API Fixes: - Changed CommandJob.id from i32 to i64 for database compatibility - Added UUID generation in create_command (message_id field) - Fixed claim_pending_commands to query queue_name = 'internal.file' - Fixed field mappings: command_id → message_id, job_type → command_type - Added support for 'processing' status in CommandJobStatus Queue System: - internal.file queue: for register/unregister/re-scan commands (job_worker) - pipeline.commands queue: for vectorize/store_asrx/etc commands (pipeline_worker) Documentation: - Added comprehensive queue system documentation - Created M4 workspace status reports - Updated AGENTS.md with queue system details
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
use sqlx::postgres::PgPoolOptions;
|
||||
use std::env;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// 加载 .env
|
||||
dotenv::dotenv().ok();
|
||||
|
||||
let database_url = env::var("DATABASE_URL")
|
||||
.expect("DATABASE_URL must be set");
|
||||
|
||||
println!("Connecting to database...");
|
||||
let pool = PgPoolOptions::new()
|
||||
.max_connections(5)
|
||||
.connect(&database_url)
|
||||
.await?;
|
||||
|
||||
println!("Reading migration file...");
|
||||
let sql = include_str!("../migrations/20261011_vlm_queue.sql");
|
||||
|
||||
println!("Running migration...");
|
||||
|
||||
// 分割 SQL 语句并逐个执行
|
||||
for statement in sql.split(';') {
|
||||
let statement = statement.trim();
|
||||
if !statement.is_empty() && !statement.starts_with("--") {
|
||||
match sqlx::query(statement).execute(&pool).await {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
// 忽略已存在的错误
|
||||
if !e.to_string().contains("already exists") {
|
||||
eprintln!("Error executing statement: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
println!("✅ Migration completed successfully!");
|
||||
|
||||
// 验证表创建
|
||||
let table_exists: bool = sqlx::query_scalar(
|
||||
r#"
|
||||
SELECT EXISTS (
|
||||
SELECT 1 FROM information_schema.tables
|
||||
WHERE table_name = 'vlm_requests'
|
||||
)
|
||||
"#,
|
||||
)
|
||||
.fetch_one(&pool)
|
||||
.await?;
|
||||
|
||||
if table_exists {
|
||||
println!("✅ Table vlm_requests created");
|
||||
} else {
|
||||
println!("❌ Table vlm_requests not found");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user