INNER CODE UNIT · Rust

run_migrations

rkudryashov/graphql-rust-demo · planets-service/src/lib.rs:82

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::<Arc<PgPool>>()
        .expect("Can't get pool")
        .get()
        .expect("Can't get DB connection")
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…