From 9dd3a8766f2c07d0036767065cc28e79db9485f6 Mon Sep 17 00:00:00 2001 From: Nulo Date: Tue, 30 Jan 2024 11:48:09 -0300 Subject: [PATCH] db: arreglar init --- scraper-rs/src/db.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scraper-rs/src/db.rs b/scraper-rs/src/db.rs index 2385f04..78f9d4b 100644 --- a/scraper-rs/src/db.rs +++ b/scraper-rs/src/db.rs @@ -5,6 +5,7 @@ use std::{ }; use sqlx::{sqlite::SqliteConnectOptions, SqlitePool}; +use tracing::info; use crate::{best_selling::BestSellingRecord, PrecioPoint}; @@ -16,10 +17,11 @@ pub struct Db { impl Db { pub async fn connect() -> anyhow::Result { let db_path = env::var("DB_PATH").unwrap_or("../sqlite.db".to_string()); + info!("Opening DB at {}", db_path); let pool = sqlx::pool::PoolOptions::new() .max_connections(1) .connect_with( - SqliteConnectOptions::from_str(&db_path)? + SqliteConnectOptions::from_str(&format!("sqlite://{}", db_path))? .journal_mode(sqlx::sqlite::SqliteJournalMode::Wal) .synchronous(sqlx::sqlite::SqliteSynchronous::Normal) .optimize_on_close(true, None),