tsk-70: Remove src/lib.rs (#74)
All checks were successful
Release Tagging / release (push) Successful in 36s
Rust Build / Check (push) Successful in 39s
Rust Build / Test Suite (push) Successful in 1m8s
Rust Build / Rustfmt (push) Successful in 33s
Rust Build / Clippy (push) Successful in 41s
Rust Build / build (push) Successful in 59s

Closes #70

Reviewed-on: #74
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
2025-10-20 17:12:54 +00:00
committed by phoenix
parent e86ca4b2c8
commit eb6ddbc97a
6 changed files with 45 additions and 54 deletions

20
src/db/init.rs Normal file
View File

@@ -0,0 +1,20 @@
use sqlx::postgres::PgPoolOptions;
pub async fn create_pool() -> Result<sqlx::PgPool, sqlx::Error> {
let database_url = icarus_envy::environment::get_db_url().await.value;
println!("Database url: {database_url}");
PgPoolOptions::new()
.max_connections(super::connection_settings::MAXCONN)
.connect(&database_url)
.await
}
pub async fn migrations(pool: &sqlx::PgPool) {
// Run migrations using the sqlx::migrate! macro
// Assumes your migrations are in a ./migrations folder relative to Cargo.toml
sqlx::migrate!("./migrations")
.run(pool)
.await
.expect("Failed to run migrations");
}