43 lines
1.5 KiB
Rust
43 lines
1.5 KiB
Rust
use sqlx::postgres::PgPoolOptions;
|
|
use sqlx::Row;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
let url = std::env::var("DATABASE_URL")
|
|
.unwrap_or_else(|_| "postgres://accusys@localhost:5432/momentry".into());
|
|
let pool = PgPoolOptions::new()
|
|
.max_connections(1)
|
|
.connect(&url)
|
|
.await?;
|
|
|
|
// Check videos columns
|
|
let rows = sqlx::query(
|
|
"SELECT column_name, data_type FROM information_schema.columns WHERE table_schema='public' AND table_name='videos' ORDER BY ordinal_position"
|
|
).fetch_all(&pool).await?;
|
|
println!("=== public.videos columns ===");
|
|
for r in &rows {
|
|
let col: String = r.get("column_name");
|
|
let typ: String = r.get("data_type");
|
|
println!(" {}: {}", col, typ);
|
|
}
|
|
|
|
// Check chunks_rule1 columns
|
|
let rows2 = sqlx::query(
|
|
"SELECT column_name, data_type FROM information_schema.columns WHERE table_schema='public' AND table_name='chunks_rule1' ORDER BY ordinal_position"
|
|
).fetch_all(&pool).await?;
|
|
println!("=== public.chunks_rule1 columns ===");
|
|
for r in &rows2 {
|
|
let col: String = r.get("column_name");
|
|
let typ: String = r.get("data_type");
|
|
println!(" {}: {}", col, typ);
|
|
}
|
|
|
|
// Check if jobs exists
|
|
let exists: bool = sqlx::query_scalar(
|
|
"SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_schema='public' AND table_name='jobs')"
|
|
).fetch_one(&pool).await?;
|
|
println!("=== public.jobs exists: {} ===", exists);
|
|
|
|
Ok(())
|
|
}
|