pub async fn do_migrate(
    file: impl AsRef<Path> + Debug
) -> Result<SqlitePool, MigrateError>
Examples found in repository?
src/lib.rs (line 221)
220
221
222
223
    pub async fn do_migrate(dir_path: &Path) -> Result<(), MigrateError> {
        migration::do_migrate(db::get_file(dir_path)).await?;
        Ok(())
    }
More examples
Hide additional examples
src/db.rs (line 18)
11
12
13
14
15
16
17
18
19
20
21
22
23
pub async fn get_pool(dir_path: impl AsRef<Path>) -> Result<SqlitePool, sqlx::error::Error> {
    let file = get_file(dir_path);
    let opt = SqliteConnectOptions::new()
        .filename(&file)
        .journal_mode(SqliteJournalMode::Off);
    let res = SqlitePool::connect_with(opt).await;
    let pool = if res.is_err() {
        crate::migration::do_migrate(file).await?
    } else {
        res?
    };
    Ok(pool)
}