Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deps #164

Merged
merged 1 commit into from
Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ orbs:
parameters:
stable:
type: string
default: "1.51"
default: "1.53"
previous:
type: string
default: "1.50"
default: "1.52"
nightly:
type: string
default: "rustlang/rust:nightly"
Expand Down
95 changes: 57 additions & 38 deletions refinery/tests/mysql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ mod mysql {
}

fn clean_database() {
let mut conn =
mysql::Conn::new("mysql://refinery:root@localhost:3306/refinery_test").unwrap();
let opts =
mysql::Opts::from_url("mysql://refinery:root@localhost:3306/refinery_test").unwrap();
let mut conn = mysql::Conn::new(opts).unwrap();

"DROP DATABASE refinery_test".run(&mut conn).unwrap();
"CREATE DATABASE refinery_test".run(conn).unwrap();
Expand All @@ -87,8 +88,9 @@ mod mysql {
#[test]
fn report_contains_applied_migrations() {
run_test(|| {
let pool =
mysql::Pool::new("mysql://refinery:root@localhost:3306/refinery_test").unwrap();
let opts = mysql::Opts::from_url("mysql://refinery:root@localhost:3306/refinery_test")
.unwrap();
let pool = mysql::Pool::new(opts).unwrap();
let mut conn = pool.get_conn().unwrap();
let report = embedded::migrations::runner().run(&mut conn).unwrap();

Expand Down Expand Up @@ -117,8 +119,9 @@ mod mysql {
#[test]
fn embedded_creates_migration_table() {
run_test(|| {
let pool =
mysql::Pool::new("mysql://refinery:root@localhost:3306/refinery_test").unwrap();
let opts = mysql::Opts::from_url("mysql://refinery:root@localhost:3306/refinery_test")
.unwrap();
let pool = mysql::Pool::new(opts).unwrap();
let mut conn = pool.get_conn().unwrap();
embedded::migrations::runner().run(&mut conn).unwrap();
for row in "SELECT table_name FROM information_schema.tables WHERE table_name='refinery_schema_history'".run(conn).unwrap()
Expand All @@ -132,8 +135,9 @@ mod mysql {
#[test]
fn embedded_creates_migration_table_grouped_transaction() {
run_test(|| {
let pool =
mysql::Pool::new("mysql://refinery:root@localhost:3306/refinery_test").unwrap();
let opts = mysql::Opts::from_url("mysql://refinery:root@localhost:3306/refinery_test")
.unwrap();
let pool = mysql::Pool::new(opts).unwrap();
let mut conn = pool.get_conn().unwrap();
embedded::migrations::runner()
.set_grouped(false)
Expand All @@ -151,8 +155,9 @@ mod mysql {
#[test]
fn embedded_applies_migration() {
run_test(|| {
let pool =
mysql::Pool::new("mysql://refinery:root@localhost:3306/refinery_test").unwrap();
let opts = mysql::Opts::from_url("mysql://refinery:root@localhost:3306/refinery_test")
.unwrap();
let pool = mysql::Pool::new(opts).unwrap();
let mut conn = pool.get_conn().unwrap();

embedded::migrations::runner().run(&mut conn).unwrap();
Expand All @@ -172,8 +177,9 @@ mod mysql {
#[test]
fn embedded_applies_migration_grouped_transaction() {
run_test(|| {
let pool =
mysql::Pool::new("mysql://refinery:root@localhost:3306/refinery_test").unwrap();
let opts = mysql::Opts::from_url("mysql://refinery:root@localhost:3306/refinery_test")
.unwrap();
let pool = mysql::Pool::new(opts).unwrap();
let mut conn = pool.get_conn().unwrap();

embedded::migrations::runner()
Expand All @@ -197,8 +203,9 @@ mod mysql {
#[test]
fn embedded_updates_schema_history() {
run_test(|| {
let pool =
mysql::Pool::new("mysql://refinery:root@localhost:3306/refinery_test").unwrap();
let opts = mysql::Opts::from_url("mysql://refinery:root@localhost:3306/refinery_test")
.unwrap();
let pool = mysql::Pool::new(opts).unwrap();
let mut conn = pool.get_conn().unwrap();

embedded::migrations::runner().run(&mut conn).unwrap();
Expand All @@ -212,8 +219,9 @@ mod mysql {
#[test]
fn embedded_updates_schema_history_grouped_transaction() {
run_test(|| {
let pool =
mysql::Pool::new("mysql://refinery:root@localhost:3306/refinery_test").unwrap();
let opts = mysql::Opts::from_url("mysql://refinery:root@localhost:3306/refinery_test")
.unwrap();
let pool = mysql::Pool::new(opts).unwrap();
let mut conn = pool.get_conn().unwrap();

embedded::migrations::runner()
Expand All @@ -232,8 +240,9 @@ mod mysql {
#[test]
fn embedded_updates_to_last_working_if_not_grouped() {
run_test(|| {
let pool =
mysql::Pool::new("mysql://refinery:root@localhost:3306/refinery_test").unwrap();
let opts = mysql::Opts::from_url("mysql://refinery:root@localhost:3306/refinery_test")
.unwrap();
let pool = mysql::Pool::new(opts).unwrap();
let mut conn = pool.get_conn().unwrap();

let result = broken::migrations::runner().run(&mut conn);
Expand Down Expand Up @@ -287,8 +296,9 @@ mod mysql {
#[test]
fn mod_creates_migration_table() {
run_test(|| {
let pool =
mysql::Pool::new("mysql://refinery:root@localhost:3306/refinery_test").unwrap();
let opts = mysql::Opts::from_url("mysql://refinery:root@localhost:3306/refinery_test")
.unwrap();
let pool = mysql::Pool::new(opts).unwrap();
let mut conn = pool.get_conn().unwrap();
mod_migrations::runner().run(&mut conn).unwrap();
for row in "SELECT table_name FROM information_schema.tables WHERE table_name='refinery_schema_history'".run(conn).unwrap()
Expand All @@ -302,8 +312,9 @@ mod mysql {
#[test]
fn mod_applies_migration() {
run_test(|| {
let pool =
mysql::Pool::new("mysql://refinery:root@localhost:3306/refinery_test").unwrap();
let opts = mysql::Opts::from_url("mysql://refinery:root@localhost:3306/refinery_test")
.unwrap();
let pool = mysql::Pool::new(opts).unwrap();
let mut conn = pool.get_conn().unwrap();

mod_migrations::runner().run(&mut conn).unwrap();
Expand All @@ -323,8 +334,9 @@ mod mysql {
#[test]
fn mod_updates_schema_history() {
run_test(|| {
let pool =
mysql::Pool::new("mysql://refinery:root@localhost:3306/refinery_test").unwrap();
let opts = mysql::Opts::from_url("mysql://refinery:root@localhost:3306/refinery_test")
.unwrap();
let pool = mysql::Pool::new(opts).unwrap();
let mut conn = pool.get_conn().unwrap();

mod_migrations::runner().run(&mut conn).unwrap();
Expand All @@ -339,8 +351,9 @@ mod mysql {
#[test]
fn gets_applied_migrations() {
run_test(|| {
let pool =
mysql::Pool::new("mysql://refinery:root@localhost:3306/refinery_test").unwrap();
let opts = mysql::Opts::from_url("mysql://refinery:root@localhost:3306/refinery_test")
.unwrap();
let pool = mysql::Pool::new(opts).unwrap();
let mut conn = pool.get_conn().unwrap();

embedded::migrations::runner().run(&mut conn).unwrap();
Expand Down Expand Up @@ -369,8 +382,9 @@ mod mysql {
#[test]
fn applies_new_migration() {
run_test(|| {
let pool =
mysql::Pool::new("mysql://refinery:root@localhost:3306/refinery_test").unwrap();
let opts = mysql::Opts::from_url("mysql://refinery:root@localhost:3306/refinery_test")
.unwrap();
let pool = mysql::Pool::new(opts).unwrap();
let mut conn = pool.get_conn().unwrap();

embedded::migrations::runner().run(&mut conn).unwrap();
Expand All @@ -390,8 +404,9 @@ mod mysql {
#[test]
fn migrates_to_target_migration() {
run_test(|| {
let pool =
mysql::Pool::new("mysql://refinery:root@localhost:3306/refinery_test").unwrap();
let opts = mysql::Opts::from_url("mysql://refinery:root@localhost:3306/refinery_test")
.unwrap();
let pool = mysql::Pool::new(opts).unwrap();
let mut conn = pool.get_conn().unwrap();

let report = embedded::migrations::runner()
Expand Down Expand Up @@ -424,8 +439,9 @@ mod mysql {
#[test]
fn migrates_to_target_migration_grouped() {
run_test(|| {
let pool =
mysql::Pool::new("mysql://refinery:root@localhost:3306/refinery_test").unwrap();
let opts = mysql::Opts::from_url("mysql://refinery:root@localhost:3306/refinery_test")
.unwrap();
let pool = mysql::Pool::new(opts).unwrap();
let mut conn = pool.get_conn().unwrap();

let report = embedded::migrations::runner()
Expand Down Expand Up @@ -458,8 +474,9 @@ mod mysql {
#[test]
fn aborts_on_missing_migration_on_filesystem() {
run_test(|| {
let pool =
mysql::Pool::new("mysql://refinery:root@localhost:3306/refinery_test").unwrap();
let opts = mysql::Opts::from_url("mysql://refinery:root@localhost:3306/refinery_test")
.unwrap();
let pool = mysql::Pool::new(opts).unwrap();
let mut conn = pool.get_conn().unwrap();

mod_migrations::runner().run(&mut conn).unwrap();
Expand All @@ -486,8 +503,9 @@ mod mysql {
#[test]
fn aborts_on_divergent_migration() {
run_test(|| {
let pool =
mysql::Pool::new("mysql://refinery:root@localhost:3306/refinery_test").unwrap();
let opts = mysql::Opts::from_url("mysql://refinery:root@localhost:3306/refinery_test")
.unwrap();
let pool = mysql::Pool::new(opts).unwrap();
let mut conn = pool.get_conn().unwrap();

mod_migrations::runner().run(&mut conn).unwrap();
Expand Down Expand Up @@ -515,8 +533,9 @@ mod mysql {
#[test]
fn aborts_on_missing_migration_on_database() {
run_test(|| {
let pool =
mysql::Pool::new("mysql://refinery:root@localhost:3306/refinery_test").unwrap();
let opts = mysql::Opts::from_url("mysql://refinery:root@localhost:3306/refinery_test")
.unwrap();
let pool = mysql::Pool::new(opts).unwrap();
let mut conn = pool.get_conn().unwrap();

missing::migrations::runner().run(&mut conn).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions refinery_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ walkdir = "2.3.1"

rusqlite = {version = ">= 0.23, < 0.26", optional = true}
postgres = {version = "0.19", optional = true}
mysql = {version = "20", optional = true}
tokio-postgres = { version = "0.7", optional = true }
mysql_async = { version = "0.26", optional = true }
mysql = { version = "21.0.0", optional = true }
mysql_async = { version = "0.28.0", optional = true }

tokio = { version = "1.0", features = ["full"], optional = true }

Expand Down
3 changes: 2 additions & 1 deletion refinery_core/src/drivers/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ macro_rules! with_connection {
cfg_if::cfg_if! {
if #[cfg(feature = "mysql")] {
let url = build_db_url("mysql", &$config);
let conn = mysql::Conn::new(&url).migration_err("could not connect to database", None)?;
let opts = mysql::Opts::from_url(&url).migration_err("could not parse url", None)?;
let conn = mysql::Conn::new(opts).migration_err("could not connect to database", None)?;
$op(conn)
} else {
panic!("tried to migrate from config for a mysql database, but feature mysql not enabled!");
Expand Down