Initial commit - current CRM state
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
use sqlx::postgres::PgPoolOptions;
|
||||
use sqlx::PgPool;
|
||||
|
||||
pub async fn init_db_pool(database_url: &str) -> PgPool {
|
||||
PgPoolOptions::new()
|
||||
.max_connections(20)
|
||||
.connect(database_url)
|
||||
.await
|
||||
.expect("Failed to connect to PostgreSQL database")
|
||||
}
|
||||
|
||||
pub async fn verify_connection(pool: &PgPool) -> bool {
|
||||
sqlx::query_scalar::<_, i32>("SELECT 1")
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.is_ok()
|
||||
}
|
||||
Reference in New Issue
Block a user