summaryrefslogtreecommitdiffstats
path: root/service-person/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'service-person/src/main.rs')
-rw-r--r--service-person/src/main.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/service-person/src/main.rs b/service-person/src/main.rs
index 1a47c51..3c5dc74 100644
--- a/service-person/src/main.rs
+++ b/service-person/src/main.rs
@@ -1,5 +1,7 @@
#[macro_use]
extern crate diesel;
+#[macro_use]
+extern crate diesel_migrations;
use std::str::FromStr;
@@ -14,6 +16,7 @@ mod model;
use model::*;
+embed_migrations!("migrations");
type DbPool = Pool<ConnectionManager<PgConnection>>;
@@ -52,6 +55,11 @@ async fn main() -> anyhow::Result<()> {
let db_connection_pool = establish_connection();
+ {
+ let conn = db_connection_pool.get().expect("Failed to get connection from pool");
+ embedded_migrations::run_with_output(&conn, &mut std::io::stdout());
+ } // drop `conn` here
+
HttpServer::new(move || {
App::new()
.data(db_connection_pool.clone())