/// Run all initial schema migrations.
///
/// Creates the "entities" table if it doesn't already exist.
Run all initial schema migrations.
Creates the "entities" table if it doesn't already exist.
Run all initial schema migrations . Creates the " entities " table if it doesn ' t already exist .
fn initiate_schema(logger: &Logger, conn: &PgConnection) {
    // Collect migration logging output
    let mut output = vec![];
    match embedded_migrations::run_with_output(conn, &mut output) {
        Ok(_) => info!(logger, "Completed pending Postgres schema migrations"),
        Err(e) => panic!(
            "Error setting up Postgres database: \
             You may need to drop and recreate your database to work with the \
             latest version of graph-node. Error information: {:?}",
            e
        ),
    }
    // If there was any migration output, log it now
    if !output.is_empty() {
        debug!(
            logger, "Postgres migration output";
            "output" => String::from_utf8(output)
                .unwrap_or_else(|_| String::from("<unreadable>"))
        );
        // We take getting output as a signal that a migration was actually
        // run, which is not easy to tell from the Diesel API, and reset the
        // query statistics since a schema change makes them not all that
        // useful. An error here is not serious and can be ignored.
        let res = conn.batch_execute("select pg_stat_statements_reset()");
        if let Err(e) = res {
            trace!(logger, "Failed to reset query statistics ({})", e);
        }
    }
}
fn initiate_schema ( logger : & Logger , conn : & PgConnection ) { // Collect migration logging output let mut output = vec ! [ ] ; match embedded_migrations :: run_with_output ( conn , & mut output ) { Ok ( _ ) => info ! ( logger " " ) , Err ( e ) => panic ! ( " \
 \
 " e ) , } // If there was any migration output, log it now if ! output . is_empty ( ) { debug ! ( logger " " " " String from_utf8 ( output ) unwrap_or_else ( String from ( " " ) ) ) ; // We take getting output as a signal that a migration was actually // run, which is not easy to tell from the Diesel API, and reset the // query statistics since a schema change makes them not all that // useful. An error here is not serious and can be ignored. let res = conn . batch_execute ( " " ) ; if let Err ( e ) = res { trace ! ( logger " " e ) ; } } }
Run all initial schema migrations.
Run all initial schema migrations .
logger
&Logger
conn
&PgConnection