diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2024-10-02 01:10:09 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2024-10-02 01:10:09 -0400 |
| commit | 6f07e6869bbf62903ac83c9bc061e7bde997e6a8 (patch) | |
| tree | 75fa34f83ccf207db83d3d0a34ff9963927fadf8 /src/repo/pool.rs | |
| parent | 5d3392799f88c5a3d3f9c656c73d6e8ac5c4d793 (diff) | |
Retire top-level `repo`.
This helped me discover an organizational scheme I like more.
Diffstat (limited to 'src/repo/pool.rs')
| -rw-r--r-- | src/repo/pool.rs | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/src/repo/pool.rs b/src/repo/pool.rs deleted file mode 100644 index b4aa6fc..0000000 --- a/src/repo/pool.rs +++ /dev/null @@ -1,18 +0,0 @@ -use std::str::FromStr; - -use sqlx::sqlite::{SqliteConnectOptions, SqlitePool, SqlitePoolOptions}; - -pub async fn prepare(url: &str) -> sqlx::Result<SqlitePool> { - let pool = create(url).await?; - sqlx::migrate!().run(&pool).await?; - Ok(pool) -} - -async fn create(database_url: &str) -> sqlx::Result<SqlitePool> { - let options = SqliteConnectOptions::from_str(database_url)? - .create_if_missing(true) - .optimize_on_close(true, /* analysis_limit */ None); - - let pool = SqlitePoolOptions::new().connect_with(options).await?; - Ok(pool) -} |
