use sqlx::{postgres::PgPoolOptions, PgPool}; use std::time::Duration; pub async fn create_pool(database_url: &str) -> Result { PgPoolOptions::new() .max_connections(10) .acquire_timeout(Duration::from_secs(30)) .idle_timeout(Duration::from_secs(300)) .connect(database_url) .await } pub async fn run_migrations(pool: &PgPool) -> Result<(), sqlx::migrate::MigrateError> { // Migrations are run from the workspace root where migrations/ folder exists sqlx::migrate!("../../migrations").run(pool).await }