Skip to main content

open_database

Function open_database 

Source
pub async fn open_database(
    url: &str,
    migrations: &Migrator,
) -> Result<PgPool, Error>
Expand description

A connection pool to the service’s Postgres database at url, after creating the database if there’s none yet and bringing it up to date with migrations. Those two go through direct_database_url, as they need a session of their own (sqlx serialises migrations with an advisory lock, so instances may start at once).