|
@ -31,8 +31,11 @@ pub struct PostgresGateway { |
|
|
|
|
|
|
|
|
impl PostgresGateway {
|
|
|
impl PostgresGateway {
|
|
|
pub fn new(host: &str, dbname: &str, username: &str, password: &str) -> PostgresGateway {
|
|
|
pub fn new(host: &str, dbname: &str, username: &str, password: &str) -> PostgresGateway {
|
|
|
// the postgres dep can be removed once refinery supports sqlx
|
|
|
|
|
|
let mut conn = Client::connect(&format!("host='{}' dbname='{}' user='{}' password='{}'", host, dbname, username, password), NoTls).unwrap();
|
|
|
|
|
|
|
|
|
let mut conn = refinery::config::Config::new(refinery::config::ConfigDbType::Postgres)
|
|
|
|
|
|
.set_db_host(&host)
|
|
|
|
|
|
.set_db_user(&username)
|
|
|
|
|
|
.set_db_pass(&password)
|
|
|
|
|
|
.set_db_name(&dbname);
|
|
|
embedded::migrations::runner().run(&mut conn).unwrap();
|
|
|
embedded::migrations::runner().run(&mut conn).unwrap();
|
|
|
|
|
|
|
|
|
let pool = async_std::task::block_on(async move {
|
|
|
let pool = async_std::task::block_on(async move {
|
|
|