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

sqlx-postgres feature #349

Closed
Closed
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@
Refinery.toml
target/
Cargo.lock

# dev
.dir-locals.el
1 change: 1 addition & 0 deletions examples/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(unused_imports)]
use barrel::backend::Sqlite as Sql;
use log::info;
use refinery::Migration;
Expand Down
1 change: 1 addition & 0 deletions refinery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ rusqlite = ["refinery-core/rusqlite"]
postgres = ["refinery-core/postgres"]
mysql = ["refinery-core/mysql"]
tokio-postgres = ["refinery-core/tokio-postgres"]
sqlx-postgres = ["refinery-core/sqlx-postgres"]
mysql_async = ["refinery-core/mysql_async"]
tiberius = ["refinery-core/tiberius"]
tiberius-config = ["refinery-core/tiberius", "refinery-core/tiberius-config"]
Expand Down
2 changes: 1 addition & 1 deletion refinery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ for more examples refer to the [examples](https://github.com/rust-db/refinery/tr
pub use refinery_core::config;
pub use refinery_core::{error, load_sql_migrations, Error, Migration, Report, Runner, Target};
#[doc(hidden)]
pub use refinery_core::{AsyncMigrate, Migrate};
pub use refinery_core::{AsyncExecutor, AsyncMigrate, Executor, Migrate};
pub use refinery_macros::embed_migrations;
16 changes: 14 additions & 2 deletions refinery/tests/mysql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,37 @@ mod mysql {
fn get_migrations() -> Vec<Migration> {
embed_migrations!("./tests/migrations");

let migration1 =
Migration::unapplied("V1__initial.rs", &migrations::V1__initial::migration()).unwrap();
let migration1 = Migration::unapplied(
"V1__initial.rs",
None,
&migrations::V1__initial::migration(),
)
.unwrap();

let migration2 = Migration::unapplied(
"V2__add_cars_and_motos_table.sql",
None,
include_str!("./migrations/V1-2/V2__add_cars_and_motos_table.sql"),
)
.unwrap();

let migration3 = Migration::unapplied(
"V3__add_brand_to_cars_table",
None,
include_str!("./migrations/V3/V3__add_brand_to_cars_table.sql"),
)
.unwrap();

let migration4 = Migration::unapplied(
"V4__add_year_to_motos_table.rs",
None,
&migrations::V4__add_year_to_motos_table::migration(),
)
.unwrap();

let migration5 = Migration::unapplied(
"V5__add_year_field_to_cars",
None,
"ALTER TABLE cars ADD year INTEGER;",
)
.unwrap();
Expand Down Expand Up @@ -472,6 +480,7 @@ mod mysql {

let migration = Migration::unapplied(
"V4__add_year_field_to_cars",
None,
"ALTER TABLE cars ADD year INTEGER;",
)
.unwrap();
Expand Down Expand Up @@ -508,6 +517,7 @@ mod mysql {

let migration = Migration::unapplied(
"V2__add_year_field_to_cars",
None,
"ALTER TABLE cars ADD year INTEGER;",
)
.unwrap();
Expand Down Expand Up @@ -545,6 +555,7 @@ mod mysql {

let migration1 = Migration::unapplied(
"V1__initial",
None,
concat!(
"CREATE TABLE persons (",
"id int,",
Expand All @@ -557,6 +568,7 @@ mod mysql {

let migration2 = Migration::unapplied(
"V2__add_cars_table",
None,
include_str!("./migrations_missing/V2__add_cars_table.sql"),
)
.unwrap();
Expand Down
16 changes: 14 additions & 2 deletions refinery/tests/mysql_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,37 @@ mod mysql_async {
fn get_migrations() -> Vec<Migration> {
embed_migrations!("./tests/migrations");

let migration1 =
Migration::unapplied("V1__initial.rs", &migrations::V1__initial::migration()).unwrap();
let migration1 = Migration::unapplied(
"V1__initial.rs",
None,
&migrations::V1__initial::migration(),
)
.unwrap();

let migration2 = Migration::unapplied(
"V2__add_cars_and_motos_table.sql",
None,
include_str!("./migrations/V1-2/V2__add_cars_and_motos_table.sql"),
)
.unwrap();

let migration3 = Migration::unapplied(
"V3__add_brand_to_cars_table",
None,
include_str!("./migrations/V3/V3__add_brand_to_cars_table.sql"),
)
.unwrap();

let migration4 = Migration::unapplied(
"V4__add_year_to_motos_table.rs",
None,
&migrations::V4__add_year_to_motos_table::migration(),
)
.unwrap();

let migration5 = Migration::unapplied(
"V5__add_year_field_to_cars",
None,
"ALTER TABLE cars ADD year INTEGER;",
)
.unwrap();
Expand Down Expand Up @@ -482,6 +490,7 @@ mod mysql_async {

let migration = Migration::unapplied(
"V4__add_year_field_to_cars",
None,
"ALTER TABLE cars ADD year INTEGER;",
)
.unwrap();
Expand Down Expand Up @@ -527,6 +536,7 @@ mod mysql_async {

let migration = Migration::unapplied(
"V2__add_year_field_to_cars",
None,
"ALTER TABLE cars ADD year INTEGER;",
)
.unwrap();
Expand Down Expand Up @@ -568,6 +578,7 @@ mod mysql_async {

let migration1 = Migration::unapplied(
"V1__initial",
None,
concat!(
"CREATE TABLE persons (",
"id int,",
Expand All @@ -580,6 +591,7 @@ mod mysql_async {

let migration2 = Migration::unapplied(
"V2__add_cars_table",
None,
include_str!("./migrations_missing/V2__add_cars_table.sql"),
)
.unwrap();
Expand Down
16 changes: 14 additions & 2 deletions refinery/tests/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,37 @@ mod postgres {
fn get_migrations() -> Vec<Migration> {
embed_migrations!("./tests/migrations");

let migration1 =
Migration::unapplied("V1__initial.rs", &migrations::V1__initial::migration()).unwrap();
let migration1 = Migration::unapplied(
"V1__initial.rs",
None,
&migrations::V1__initial::migration(),
)
.unwrap();

let migration2 = Migration::unapplied(
"V2__add_cars_and_motos_table.sql",
None,
include_str!("./migrations/V1-2/V2__add_cars_and_motos_table.sql"),
)
.unwrap();

let migration3 = Migration::unapplied(
"V3__add_brand_to_cars_table",
None,
include_str!("./migrations/V3/V3__add_brand_to_cars_table.sql"),
)
.unwrap();

let migration4 = Migration::unapplied(
"V4__add_year_to_motos_table.rs",
None,
&migrations::V4__add_year_to_motos_table::migration(),
)
.unwrap();

let migration5 = Migration::unapplied(
"V5__add_year_field_to_cars",
None,
"ALTER TABLE cars ADD year INTEGER;",
)
.unwrap();
Expand Down Expand Up @@ -446,6 +454,7 @@ mod postgres {

let migration = Migration::unapplied(
"V4__add_year_field_to_cars",
None,
"ALTER TABLE cars ADD year INTEGER;",
)
.unwrap();
Expand Down Expand Up @@ -479,6 +488,7 @@ mod postgres {

let migration = Migration::unapplied(
"V2__add_year_field_to_cars",
None,
"ALTER TABLE cars ADD year INTEGER;",
)
.unwrap();
Expand Down Expand Up @@ -513,6 +523,7 @@ mod postgres {

let migration1 = Migration::unapplied(
"V1__initial",
None,
concat!(
"CREATE TABLE persons (",
"id int,",
Expand All @@ -525,6 +536,7 @@ mod postgres {

let migration2 = Migration::unapplied(
"V2__add_cars_table",
None,
include_str!("./migrations_missing/V2__add_cars_table.sql"),
)
.unwrap();
Expand Down
16 changes: 14 additions & 2 deletions refinery/tests/rusqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,29 +50,37 @@ mod rusqlite {
fn get_migrations() -> Vec<Migration> {
embed_migrations!("./tests/migrations");

let migration1 =
Migration::unapplied("V1__initial.rs", &migrations::V1__initial::migration()).unwrap();
let migration1 = Migration::unapplied(
"V1__initial.rs",
None,
&migrations::V1__initial::migration(),
)
.unwrap();

let migration2 = Migration::unapplied(
"V2__add_cars_and_motos_table.sql",
None,
include_str!("./migrations/V1-2/V2__add_cars_and_motos_table.sql"),
)
.unwrap();

let migration3 = Migration::unapplied(
"V3__add_brand_to_cars_table",
None,
include_str!("./migrations/V3/V3__add_brand_to_cars_table.sql"),
)
.unwrap();

let migration4 = Migration::unapplied(
"V4__add_year_to_motos_table.rs",
None,
&migrations::V4__add_year_to_motos_table::migration(),
)
.unwrap();

let migration5 = Migration::unapplied(
"V5__add_year_field_to_cars",
None,
"ALTER TABLE cars ADD year INTEGER;",
)
.unwrap();
Expand Down Expand Up @@ -572,6 +580,7 @@ mod rusqlite {

let migration = Migration::unapplied(
"V4__add_year_field_to_cars",
None,
"ALTER TABLE cars ADD year INTEGER;",
)
.unwrap();
Expand Down Expand Up @@ -603,6 +612,7 @@ mod rusqlite {

let migration = Migration::unapplied(
"V2__add_year_field_to_cars",
None,
"ALTER TABLE cars ADD year INTEGER;",
)
.unwrap();
Expand Down Expand Up @@ -635,6 +645,7 @@ mod rusqlite {

let migration1 = Migration::unapplied(
"V1__initial",
None,
concat!(
"CREATE TABLE persons (",
"id int,",
Expand All @@ -647,6 +658,7 @@ mod rusqlite {

let migration2 = Migration::unapplied(
"V2__add_cars_table",
None,
include_str!("./migrations_missing/V2__add_cars_table.sql"),
)
.unwrap();
Expand Down
16 changes: 14 additions & 2 deletions refinery/tests/tiberius.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,37 @@ mod tiberius {
fn get_migrations() -> Vec<Migration> {
embed_migrations!("./tests/migrations");

let migration1 =
Migration::unapplied("V1__initial.rs", &migrations::V1__initial::migration()).unwrap();
let migration1 = Migration::unapplied(
"V1__initial.rs",
None,
&migrations::V1__initial::migration(),
)
.unwrap();

let migration2 = Migration::unapplied(
"V2__add_cars_and_motos_table.sql",
None,
include_str!("./migrations/V1-2/V2__add_cars_and_motos_table.sql"),
)
.unwrap();

let migration3 = Migration::unapplied(
"V3__add_brand_to_cars_table",
None,
include_str!("./migrations/V3/V3__add_brand_to_cars_table.sql"),
)
.unwrap();

let migration4 = Migration::unapplied(
"V4__add_year_to_motos_table.rs",
None,
&migrations::V4__add_year_to_motos_table::migration(),
)
.unwrap();

let migration5 = Migration::unapplied(
"V5__add_year_field_to_cars",
None,
"ALTER TABLE cars ADD year INTEGER;",
)
.unwrap();
Expand Down Expand Up @@ -127,6 +135,7 @@ mod tiberius {

let migration = Migration::unapplied(
"V4__add_year_field_to_cars",
None,
"ALTER TABLE cars ADD year INTEGER;",
)
.unwrap();
Expand Down Expand Up @@ -178,6 +187,7 @@ mod tiberius {

let migration = Migration::unapplied(
"V2__add_year_field_to_cars",
None,
"ALTER TABLE cars ADD year INTEGER;",
)
.unwrap();
Expand Down Expand Up @@ -230,6 +240,7 @@ mod tiberius {

let migration1 = Migration::unapplied(
"V1__initial",
None,
concat!(
"CREATE TABLE persons (",
"id int,",
Expand All @@ -242,6 +253,7 @@ mod tiberius {

let migration2 = Migration::unapplied(
"V2__add_cars_table",
None,
include_str!("./migrations_missing/V2__add_cars_table.sql"),
)
.unwrap();
Expand Down
Loading
Loading