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 postgres and tokio-postgres to stable versions 0.17.0 and 0.5.0 respectively #32

Merged
merged 2 commits into from
Dec 25, 2019
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
28 changes: 12 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
- checkout
- run: rustup self update
- run: cd refinery_macros && cargo test
- run: cd refinery_migrations && cargo test --features=sync,postgres
- run: cd refinery_cli && cargo test
- run: cd refinery_migrations && cargo test --features=sync,mysql
- run: cd refinery_cli && cargo test --features=mysql,postgres-previous,sqlite-bundled --no-default-features
cargo-fmt-clippy-and-test-macros-and-cli-stable:
docker:
- image: << pipeline.parameters.stable >>
Expand Down Expand Up @@ -70,61 +70,59 @@ jobs:
- image: << pipeline.parameters.previous >>
steps:
- checkout
- run: cargo build -p refinery_cli
- run: cargo install --path ./refinery_cli --no-default-features --features=sqlite-bundled
- run: cd refinery && cargo test --features "trusqlite" --test rusqlite
test-sqlite-stable:
docker:
- image: << pipeline.parameters.stable >>
steps:
- checkout
- run: cargo build -p refinery_cli
- run: cargo install --path ./refinery_cli --no-default-features --features=sqlite-bundled
- run: cd refinery && cargo test --features "trusqlite" --test rusqlite
test-sqlite-nightly:
docker:
- image: << pipeline.parameters.nightly >>
steps:
- checkout
- run: cargo build -p refinery_cli
- run: cargo install --path ./refinery_cli --no-default-features --features=sqlite-bundled
- run: cd refinery && cargo test --features "trusqlite" --test rusqlite
test-postgres-previous:
docker:
- image: << pipeline.parameters.previous >>
- image: postgres:9.6.13-alpine
steps:
- checkout
- run: cargo build -p refinery_cli
- run: cd refinery && cargo test -p refinery --features "tpostgres" --test postgres -- --test-threads 1
- run: cargo install --path ./refinery_cli --no-default-features --features=postgres-previous
- run: cd refinery && cargo test -p refinery --features "tppostgres" --test postgres_previous -- --test-threads 1
test-postgres-stable:
docker:
- image: << pipeline.parameters.stable >>
- image: postgres:9.6.13-alpine
steps:
- checkout
- run: cargo build -p refinery_cli
- run: cargo install --path ./refinery_cli --no-default-features --features=postgres
- run: cd refinery && cargo test -p refinery --features "tpostgres" --test postgres -- --test-threads 1
test-postgres-nightly:
docker:
- image: << pipeline.parameters.nightly >>
- image: postgres:9.6.13-alpine
steps:
- checkout
- run: cargo build -p refinery_cli
- run: cargo install --path ./refinery_cli --no-default-features --features=postgres
- run: cd refinery && cargo test -p refinery --features "tpostgres" --test postgres -- --test-threads 1
test-tokio-postgres-stable:
docker:
- image: << pipeline.parameters.stable >>
- image: postgres:9.6.13-alpine
steps:
- checkout
- run: cargo build -p refinery_cli
- run: cd refinery && cargo test -p refinery --features "tttokio-postgres" --test tokio_postgres -- --test-threads 1
test-tokio-postgres-nightly:
docker:
- image: << pipeline.parameters.nightly >>
- image: postgres:9.6.13-alpine
steps:
- checkout
- run: cargo build -p refinery_cli
- run: cd refinery && cargo test -p refinery --features "tttokio-postgres" --test tokio_postgres -- --test-threads 1
test-mysql-previous:
docker:
Expand All @@ -137,7 +135,7 @@ jobs:
MYSQL_DATABASE: refinery_test
steps:
- checkout
- run: cargo build -p refinery_cli
- run: cargo install --path ./refinery_cli --no-default-features --features=mysql
- run: cd refinery && cargo test -p refinery --features "tmysql" --test mysql -- --test-threads 1
test-mysql-stable:
docker:
Expand All @@ -150,7 +148,7 @@ jobs:
MYSQL_DATABASE: refinery_test
steps:
- checkout
- run: cargo build -p refinery_cli
- run: cargo install --path ./refinery_cli --no-default-features --features=mysql
- run: cd refinery && cargo test -p refinery --features "tmysql" --test mysql -- --test-threads 1
test-mysql-nightly:
docker:
Expand All @@ -163,7 +161,7 @@ jobs:
MYSQL_DATABASE: refinery_test
steps:
- checkout
- run: cargo build -p refinery_cli
- run: cargo install --path ./refinery_cli --no-default-features --features=mysql
- run: cd refinery && cargo test -p refinery --features "tmysql" --test mysql -- --test-threads 1
test-mysql-async-stable:
docker:
Expand All @@ -176,7 +174,6 @@ jobs:
MYSQL_DATABASE: refinery_test
steps:
- checkout
- run: cargo build -p refinery_cli
- run: cd refinery && cargo test -p refinery --features ttmysql_async --test mysql_async -- --test-threads 1
test-mysql-async-nightly:
docker:
Expand All @@ -189,7 +186,6 @@ jobs:
MYSQL_DATABASE: refinery_test
steps:
- checkout
- run: cargo build -p refinery_cli
- run: cd refinery && cargo test -p refinery --features ttmysql_async --test mysql_async -- --test-threads 1
workflows:
version: 2
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
- Add `mysql_async` driver suport [#22](https://github.com/rust-db/refinery/pull/19).
- Add `migrate_from_config` function
- Add `migrate_from_config_async` function
- Update postgres to version 0.17 [#32](https://github.com/rust-db/refinery/pull/32)
- Allow refinery_cli to select driver via features [#32](https://github.com/rust-db/refinery/pull/32)

- **Bugfixes**:
- allow multiple statements in migration files [#10](https://github.com/rust-db/refinery/issues/21)
- when building refinery_cli with default features, build with rusqlite bundled libsqlite3 [#33](https://github.com/rust-db/refinery/issues/21)

- **Dependencies**:
- update rusqlite dependency, 0.18 -> 0.21 [#26](https://github.com/rust-db/refinery/issues/26)
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ refinery's design is based on [flyway](https://flywaydb.org/) and so, shares its

## Compatibility

refinery aims to support stable Rust, the previous Rust version, and nightly.

refinery aims to support stable Rust, the previous Rust version, and nightly. To build Refinery with Rust 1.39 you have to select feature `postgres-previous` instead of `postgres` so that refinery builds with `postgres` version `0.15` instead of version `0.17`

## Async

Expand Down
15 changes: 9 additions & 6 deletions refinery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,33 @@ edition = "2018"
default = []
rusqlite = ["refinery-migrations/sync", "refinery-migrations/rusqlite", "barrel/sqlite3"]
postgres = ["refinery-migrations/sync", "refinery-migrations/postgres", "barrel/pg"]
postgres-previous = ["refinery-migrations/sync", "refinery-migrations/postgres-previous", "barrel/pg"]
mysql = ["refinery-migrations/sync", "refinery-migrations/mysql", "barrel/mysql"]
tokio-postgres = ["refinery-migrations/async", "refinery-migrations/tokio-postgres", "refinery-migrations/tokio", "barrel/pg"]
mysql_async = ["refinery-migrations/async", "refinery-migrations/mysql_async", "barrel/pg"]

#testing features
trusqlite = ["rusqlite", "mod_migrations/sqlite"]
tpostgres = ["postgres", "mod_migrations/pg"]
tpostgres = ["ttpostgres", "postgres", "mod_migrations/pg"]
tppostgres = ["tpppostgres", "postgres-previous", "mod_migrations/pg"]
tmysql = ["mysql", "mod_migrations/mysql"]
tttokio-postgres = ["tokio", "ttokio-postgres", "tokio-postgres", "mod_migrations/pg"]
ttmysql_async = ["tokio", "mysql_async", "tmysql_async", "mod_migrations/mysql"]

[dependencies]
refinery-migrations = { version = "0.2.0-alpha.1", path = "../refinery_migrations" }
refinery-macros= { version = "0.2.0-alpha.1", path = "../refinery_macros" }
refinery-migrations = { version = "0.2.0-alpha.2", path = "../refinery_migrations" }
refinery-macros= { version = "0.2.0-alpha.2", path = "../refinery_macros" }
barrel = "0.5.3"
# hack because there's no optional dev-dependencies
# and rust 1.38 doesn't support async fn's, TODO: remove when previous version is 1.38
# and rust 1.39 doesn't support #[non_exhaustive], TODO: remove when previous version is 1.40
tokio = { version = "0.2", features = ["full"], optional = true }
ttokio-postgres = {package = "tokio-postgres", version = "0.5.0-alpha.2", optional = true }
ttokio-postgres = {package = "tokio-postgres", version = "0.5.0", optional = true }
tmysql_async = { package = "mysql_async", version = "0.21", optional = true }
ttpostgres = {package = "postgres", version = "0.17", optional = true }
tpppostgres = {package = "postgres", version = "0.15", optional = true }

[dev-dependencies]
ttrusqlite = {package = "rusqlite", version = "0.21"}
ttpostgres = {package = "postgres", version = "0.15"}
futures = "0.3.1"
ttmysql = {package = "mysql", version = "16.0"}

Expand Down
5 changes: 2 additions & 3 deletions refinery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,11 @@ refinery's design is based on [flyway](https://flywaydb.org/) and so, shares its

## Compatibility

refinery aims to support stable Rust, the previous Rust version, and nightly.

refinery aims to support stable Rust, the previous Rust version, and nightly. To build Refinery with Rust 1.39 you have to select feature `postgres-previous` instead of `postgres` so that refinery builds with `postgres` version `0.15` instead of version `0.17`

## Async

Refinery supports [tokio-postgres](https://crates.io/crates/tokio-postgres) and [`mysql_async`](https://crates.io/crates/mysql_async). To migrate async you have to call `Runner`'s [run_async](https://github.com/rust-db/refinery/blob/master/refinery_migrations/src/lib.rs#L216).
Starting with version 0.2 refinery supports [tokio-postgres](https://crates.io/crates/tokio-postgres) and [`mysql_async`](https://crates.io/crates/mysql_async). To migrate async you have to call `Runner`'s [run_async](https://github.com/rust-db/refinery/blob/master/refinery_migrations/src/lib.rs#L216).
There are plans to support [Tiberius](https://github.com/steffengy/tiberius) when futures 0.3 support stabilizes.
For Rusqlite, the best way to run migrations in an async context is to run them inside tokio's [`block_in_place`](https://docs.rs/tokio/0.2.0/tokio/task/fn.block_in_place.html) for example.

Expand Down
7 changes: 6 additions & 1 deletion refinery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,10 @@ pub use refinery_migrations::{Config, ConfigDbType};
#[cfg(any(feature = "mysql_async", feature = "tokio-postgres"))]
pub use refinery_migrations::{migrate_from_config_async, AsyncMigrate};

#[cfg(any(feature = "mysql", feature = "postgres", feature = "rusqlite"))]
#[cfg(any(
feature = "mysql",
feature = "postgres",
feature = "postgres-previous",
feature = "rusqlite"
))]
pub use refinery_migrations::{migrate_from_config, Migrate};
4 changes: 2 additions & 2 deletions refinery/tests/mysql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,7 @@ mod mysql {
#[test]
fn migrates_from_cli() {
run_test(|| {
Command::cargo_bin("refinery")
.unwrap()
Command::new("refinery")
.args(&[
"migrate",
"-c",
Expand All @@ -475,6 +474,7 @@ mod mysql {
"-p",
"tests/sql_migrations",
])
.unwrap()
.assert()
.stdout(contains("applying migration: V3__add_brand_to_cars_table"));
})
Expand Down
Loading