Fix (storage): Avoid bug creating file for in-mem sqlite

This commit is contained in:
Laurenz 2024-05-01 17:20:07 +02:00
parent 7f67ac0107
commit 3a27c7e389

View file

@ -8,7 +8,7 @@ pub async fn create_pool(db_url: String) -> AnyPool {
sqlx::any::install_default_drivers();
// Create SQLite database file if it does not exist
if db_url.starts_with("sqlite:") {
if db_url.starts_with("sqlite:") && db_url != ("sqlite::memory:") {
let path = db_url.replace("sqlite:", "");
if !Path::new(&path).exists() {
warn!("Sqlite database does not exist, creating file {}", path);