use sqlx for migrations

This commit is contained in:
jake 2020-10-24 00:18:07 -06:00
parent 466195193d
commit 69374ea424

View File

@ -31,8 +31,11 @@ pub struct PostgresGateway {
impl 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();
let pool = async_std::task::block_on(async move {