From 663807baa02debd28dc01245cbf0de990c55051b Mon Sep 17 00:00:00 2001 From: Luca Palmieri Date: Wed, 2 Feb 2022 15:14:15 +0000 Subject: [PATCH] Update db/pg to v4 (#509) Co-authored-by: Rob Ede --- database_interactions/pg/Cargo.toml | 12 ++++++------ database_interactions/pg/src/main.rs | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/database_interactions/pg/Cargo.toml b/database_interactions/pg/Cargo.toml index fdd9cf52..c4a9f4ac 100644 --- a/database_interactions/pg/Cargo.toml +++ b/database_interactions/pg/Cargo.toml @@ -4,12 +4,12 @@ version = "1.0.0" edition = "2021" [dependencies] -actix-web = "3" -config = "0.10.1" -deadpool-postgres = "0.5.0" +actix-web = "4.0.0-beta.21" +config = "0.11.0" +deadpool-postgres = { version = "0.10.1", features = ["serde"] } derive_more = "0.99.2" dotenv = "0.15.0" serde = { version = "1.0.104", features = ["derive"] } -tokio-pg-mapper = "0.1" -tokio-pg-mapper-derive = "0.1" -tokio-postgres = "0.5.1" +tokio-pg-mapper = "0.2.0" +tokio-pg-mapper-derive = "0.2.0" +tokio-postgres = "0.7.5" diff --git a/database_interactions/pg/src/main.rs b/database_interactions/pg/src/main.rs index fd1e0896..ff7eb462 100644 --- a/database_interactions/pg/src/main.rs +++ b/database_interactions/pg/src/main.rs @@ -116,11 +116,11 @@ async fn main() -> std::io::Result<()> { dotenv().ok(); let config = crate::config::Config::from_env().unwrap(); - let pool = config.pg.create_pool(NoTls).unwrap(); + let pool = config.pg.create_pool(None, NoTls).unwrap(); let server = HttpServer::new(move || { App::new() - .data(pool.clone()) + .app_data(web::Data::new(pool.clone())) .service(web::resource("/users").route(web::post().to(add_user))) }) .bind(config.server_addr.clone())?