fix: pre_chunks schema + TMDb movie name extraction
- pre_chunks: add chunk_type, text_content columns; drop NOT NULL on coordinate_type/coordinate_index (INSERT statements reference these columns but CREATE TABLE was missing them) - run_migrations: add ALTER TABLE for existing databases - extract_movie_name: filter noise words (youtube, fps, 24fps, 1080p, pure digits) so 'Charade_YouTube_24fps' → 'Charade' - run-server-3002.sh: add companion worker startup (matching 3003 script)
This commit is contained in:
@@ -1040,13 +1040,25 @@ impl PostgresDb {
|
||||
.await?;
|
||||
|
||||
// ── Pre Chunks ──
|
||||
sqlx::query("CREATE TABLE IF NOT EXISTS pre_chunks (id BIGSERIAL PRIMARY KEY, file_uuid VARCHAR(255) NOT NULL, processor_type VARCHAR(50) NOT NULL, coordinate_type VARCHAR(50) NOT NULL, coordinate_index BIGINT NOT NULL, start_frame BIGINT, end_frame BIGINT, start_time DOUBLE PRECISION, end_time DOUBLE PRECISION, fps DOUBLE PRECISION, data JSONB NOT NULL, identity_id UUID, confidence DOUBLE PRECISION, created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP)").execute(pool).await?;
|
||||
sqlx::query("CREATE TABLE IF NOT EXISTS pre_chunks (id BIGSERIAL PRIMARY KEY, file_uuid VARCHAR(255) NOT NULL, processor_type VARCHAR(50) NOT NULL, chunk_type VARCHAR(50), coordinate_type VARCHAR(50), coordinate_index BIGINT, start_frame BIGINT, end_frame BIGINT, start_time DOUBLE PRECISION, end_time DOUBLE PRECISION, fps DOUBLE PRECISION, data JSONB NOT NULL, text_content TEXT, identity_id UUID, confidence DOUBLE PRECISION, created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP)").execute(pool).await?;
|
||||
sqlx::query("CREATE INDEX IF NOT EXISTS idx_pre_chunks_file_uuid ON pre_chunks(file_uuid)")
|
||||
.execute(pool)
|
||||
.await?;
|
||||
sqlx::query("CREATE INDEX IF NOT EXISTS idx_pre_chunks_processor ON pre_chunks(processor_type)")
|
||||
.execute(pool)
|
||||
.await?;
|
||||
sqlx::query("ALTER TABLE pre_chunks ADD COLUMN IF NOT EXISTS chunk_type VARCHAR(50)")
|
||||
.execute(pool)
|
||||
.await?;
|
||||
sqlx::query("ALTER TABLE pre_chunks ADD COLUMN IF NOT EXISTS text_content TEXT")
|
||||
.execute(pool)
|
||||
.await?;
|
||||
sqlx::query("ALTER TABLE pre_chunks ALTER COLUMN coordinate_type DROP NOT NULL")
|
||||
.execute(pool)
|
||||
.await?;
|
||||
sqlx::query("ALTER TABLE pre_chunks ALTER COLUMN coordinate_index DROP NOT NULL")
|
||||
.execute(pool)
|
||||
.await?;
|
||||
|
||||
// ── Monitor Jobs ──
|
||||
sqlx::query("CREATE TABLE IF NOT EXISTS monitor_jobs (id SERIAL PRIMARY KEY, uuid VARCHAR(32) NOT NULL, video_path VARCHAR(512), status VARCHAR(20) NOT NULL DEFAULT 'pending', current_processor VARCHAR(20), progress_total INT DEFAULT 0, progress_current INT DEFAULT 0, error_count INT DEFAULT 0, last_error TEXT, started_at TIMESTAMP, updated_at TIMESTAMP, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP)").execute(pool).await?;
|
||||
|
||||
Reference in New Issue
Block a user