mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-29 08:11:06 +00:00
feat(sqlite): create empty database file on connect if missing
This commit is contained in:
@@ -447,7 +447,11 @@ impl AppState {
|
||||
})
|
||||
.collect();
|
||||
PoolKind::Sqlite(
|
||||
db::sqlite::connect_path_with_extensions(&expand_tilde(&db_config.host), extensions).await?,
|
||||
db::sqlite::connect_path_create_if_missing_with_extensions(
|
||||
&expand_tilde(&db_config.host),
|
||||
extensions,
|
||||
)
|
||||
.await?,
|
||||
)
|
||||
}
|
||||
DatabaseType::Rqlite => {
|
||||
|
||||
@@ -46,6 +46,13 @@ pub async fn connect_path_create_if_missing(path: &str) -> Result<SqliteHandle,
|
||||
connect_path_with_options(path, true, Vec::new()).await
|
||||
}
|
||||
|
||||
pub async fn connect_path_create_if_missing_with_extensions(
|
||||
path: &str,
|
||||
extensions: Vec<SqliteExtensionSpec>,
|
||||
) -> Result<SqliteHandle, String> {
|
||||
connect_path_with_options(path, true, extensions).await
|
||||
}
|
||||
|
||||
async fn connect_path_with_options(
|
||||
path: &str,
|
||||
create_if_missing: bool,
|
||||
|
||||
Reference in New Issue
Block a user