use anyhow::{Context, Result}; use sqlx::postgres::PgPoolOptions; use sqlx::PgPool; pub async fn create_pool(database_url: &str) -> Result { let pool = PgPoolOptions::new() .max_connections(10) .connect(database_url) .await .context("failed to connect to database")?; sqlx::migrate!() .run(&pool) .await .context("failed to run database migrations")?; tracing::info!("database connected and migrations applied"); Ok(pool) }