refactor: remove all dev.* and public.* schema hardcodes from runtime code

14 files updated to use schema::table_name() instead of hardcoded schema
prefixes. Only src/bin/release.rs intentionally retains dev.* references.
This commit is contained in:
Accusys
2026-05-14 14:40:14 +08:00
parent 261d134fee
commit 301a95e2bc
14 changed files with 184 additions and 139 deletions

View File

@@ -11,6 +11,7 @@ use momentry_core::core::chunk::types::{Chunk, ChunkRule, ChunkType};
use momentry_core::core::db::Database;
use momentry_core::core::time::FrameTime;
use momentry_core::ui::progress::{ProcessorType, ProgressState, ProgressUi};
use momentry_core::core::db::schema;
use momentry_core::{
Embedder, OutputDir, PostgresDb, QdrantDb, RedisClient, VectorPayload, VideoRecord, VideoStatus,
};
@@ -824,8 +825,11 @@ enum N8nAction {
#[tokio::main]
async fn main() -> Result<()> {
// Load development environment first
dotenv::from_filename(".env.development").ok();
// Load development environment — try absolute path first
if dotenv::from_filename("/Users/accusys/momentry_core_0.1/.env.development").is_err() {
// Fallback to relative path (for development)
let _ = dotenv::from_filename(".env.development");
}
tracing_subscriber::fmt::init();
@@ -851,8 +855,9 @@ async fn main() -> Result<()> {
.map(|n| n.to_string_lossy().to_string())
.unwrap_or_default();
let videos_table = schema::table_name("videos");
let birthday = sqlx::query_scalar::<_, chrono::DateTime<chrono::Utc>>(
"SELECT registration_time FROM dev.videos WHERE file_name = $1 AND registration_time IS NOT NULL LIMIT 1"
&format!("SELECT registration_time FROM {} WHERE file_name = $1 AND registration_time IS NOT NULL LIMIT 1", videos_table)
)
.bind(&filename)
.fetch_optional(db.pool())
@@ -1095,8 +1100,9 @@ async fn main() -> Result<()> {
.map(|n| n.to_string_lossy().to_string())
.unwrap_or_default();
let videos_table = schema::table_name("videos");
let birthday = sqlx::query_scalar::<_, chrono::DateTime<chrono::Utc>>(
"SELECT registration_time FROM dev.videos WHERE file_name = $1 AND registration_time IS NOT NULL LIMIT 1"
&format!("SELECT registration_time FROM {} WHERE file_name = $1 AND registration_time IS NOT NULL LIMIT 1", videos_table)
)
.bind(&filename)
.fetch_optional(db.pool())