INNER CODE UNIT · Rust
run_migrations
rkudryashov/graphql-rust-demo · satellites-service/src/lib.rs:42
pub fn run_migrations(conn: &mut PooledConnection<ConnectionManager<PgConnection>>) {
conn.run_pending_migrations(MIGRATIONS)
.expect("Failed to run database migrations");
}
pub fn get_conn_from_ctx(ctx: &Context<'_>) -> PooledConnection<ConnectionManager<PgConnection>> {
ctx.data::<PgPool>()
.expect("Can't get pool")
.get()
.expect("Can't get DB connection")
}