pub fn create_db_objects(
    work_dir: &String,
    db_name: &String,
    logger: &Logger,
) -> Result<String, MeshSimError> {
    //Make sure we use a lowercase version of db_name all throughout.
    let dbm = db_name.to_lowercase();

    //Create experiment database
    let root_conn_parts = parse_env_file(ROOT_ENV_FILE)?;
    let owner: String = root_conn_parts.user_pwd.split(':').collect::<Vec<&str>>()[0].into();
    let root_conn = get_db_connection_by_file(ROOT_ENV_FILE.into(), &logger)?;
    let _ = create_database(&root_conn, &dbm, &owner, &logger)?;
    debug!(logger, "Experiment database created: {}", &dbm);

    //Write the .env file for the experiment
    let fpath = create_env_file(&dbm, work_dir, &logger)?;
    debug!(logger, "Connection file created: {}", &fpath);

    //Run all the migrations on the experiment DB
    let exp_conn = get_db_connection_by_file(fpath.clone(), &logger)?;
    let _ = embedded_migrations::run(&exp_conn);

    Ok(fpath)
}
/// Creates all the required database objects for a simulation
Creates all the required database objects for a simulation
Creates all the required database objects for a simulation
pub fn create_db_objects(
    work_dir: &String,
    db_name: &String,
    logger: &Logger,
) -> Result<String, MeshSimError> {
    //Make sure we use a lowercase version of db_name all throughout.
    let dbm = db_name.to_lowercase();
    //Create experiment database
    let root_conn_parts = parse_env_file(ROOT_ENV_FILE)?;
    let owner: String = root_conn_parts.user_pwd.split(':').collect::<Vec<&str>>()[0].into();
    let root_conn = get_db_connection_by_file(ROOT_ENV_FILE.into(), &logger)?;
    let _ = create_database(&root_conn, &dbm, &owner, &logger)?;
    debug!(logger, "Experiment database created: {}", &dbm);
    //Write the .env file for the experiment
    let fpath = create_env_file(&dbm, work_dir, &logger)?;
    debug!(logger, "Connection file created: {}", &fpath);
    //Run all the migrations on the experiment DB
    let exp_conn = get_db_connection_by_file(fpath.clone(), &logger)?;
    let _ = embedded_migrations::run(&exp_conn);
    Ok(fpath)
}
pub fn create_db_objects ( work_dir : & String , db_name : & String , logger : & Logger , ) -> Result < String , MeshSimError > { //Make sure we use a lowercase version of db_name all throughout. let dbm = db_name . to_lowercase ( ) ; //Create experiment database let root_conn_parts = parse_env_file ( ROOT_ENV_FILE ) ? ; let owner : String = root_conn_parts . user_pwd . split ( ':' ) . collect :: < Vec < & str > > ( ) [ 0 ] . into ( ) ; let root_conn = get_db_connection_by_file ( ROOT_ENV_FILE . into ( ) , & logger ) ? ; let _ = create_database ( & root_conn , & dbm , & owner , & logger ) ? ; debug ! ( logger " " dbm ) ; //Write the .env file for the experiment let fpath = create_env_file ( & dbm , work_dir , & logger ) ? ; debug ! ( logger " " fpath ) ; //Run all the migrations on the experiment DB let exp_conn = get_db_connection_by_file ( fpath . clone ( ) , & logger ) ? ; let _ = embedded_migrations :: run ( & exp_conn ) ; Ok ( fpath ) }
Creates all the required database objects for a simulation
Creates all the required database objects for a simulation
work_dir
&String
db_name
&String
logger
&Logger