0.7.22
This commit is contained in:
@@ -12,7 +12,8 @@ pub(crate) fn sqlite_database_url_from_config(
|
||||
"database.sqlite.path must not be empty".to_string(),
|
||||
));
|
||||
}
|
||||
Ok(format!("sqlite://{}", path))
|
||||
let database_path = config.sqlite.path_buf();
|
||||
Ok(format!("sqlite://{}", database_path.display()))
|
||||
}
|
||||
|
||||
/// Opens a SQLite pool according to configuration.
|
||||
@@ -30,7 +31,7 @@ pub(crate) async fn connect_sqlite(
|
||||
"database.sqlite.max_connections must be > 0".to_string(),
|
||||
));
|
||||
}
|
||||
let database_path = std::path::Path::new(path);
|
||||
let database_path = config.sqlite.path_buf();
|
||||
let parent_option = database_path.parent();
|
||||
if let Some(parent) = parent_option {
|
||||
if !parent.as_os_str().is_empty() {
|
||||
@@ -45,7 +46,7 @@ pub(crate) async fn connect_sqlite(
|
||||
}
|
||||
}
|
||||
let mut connect_options = sqlx::sqlite::SqliteConnectOptions::new()
|
||||
.filename(database_path)
|
||||
.filename(&database_path)
|
||||
.create_if_missing(config.sqlite.create_if_missing)
|
||||
.foreign_keys(true)
|
||||
.busy_timeout(std::time::Duration::from_millis(
|
||||
@@ -61,7 +62,7 @@ pub(crate) async fn connect_sqlite(
|
||||
Ok(pool) => Ok(pool),
|
||||
Err(error) => Err(crate::KbError::Db(format!(
|
||||
"cannot open sqlite database '{}': {}",
|
||||
path, error
|
||||
database_path.display(), error
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user