mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-23 18:40:24 +00:00
cargo-sqlx: update SQLx to v0.3
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -294,7 +294,7 @@ dependencies = [
|
||||
"chrono",
|
||||
"dotenv",
|
||||
"futures 0.3.4",
|
||||
"sqlx 0.2.6",
|
||||
"sqlx",
|
||||
"structopt",
|
||||
"tokio 0.2.13",
|
||||
]
|
||||
|
||||
@@ -16,11 +16,8 @@ path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
dotenv = "0.15"
|
||||
|
||||
tokio = { version = "0.2", features = ["macros"] }
|
||||
# sqlx = { path = "..", default-features = false, features = [ "runtime-tokio", "macros", "postgres" ] }
|
||||
sqlx = { version = "0.2", default-features = false, features = [ "runtime-tokio", "macros", "postgres" ] }
|
||||
futures="0.3"
|
||||
|
||||
sqlx = { version = "0.3", path = "..", default-features = false, features = [ "runtime-tokio", "postgres" ] }
|
||||
futures = "0.3"
|
||||
structopt = "0.3"
|
||||
chrono = "0.4"
|
||||
|
||||
@@ -182,19 +182,15 @@ CREATE TABLE IF NOT EXISTS __migrations (
|
||||
}
|
||||
|
||||
async fn check_if_applied(pool: &mut PgConnection, migration: &str) -> bool {
|
||||
use sqlx::row::Row;
|
||||
use sqlx::postgres::PgRow;
|
||||
use sqlx::Row;
|
||||
|
||||
let row = sqlx::query(
|
||||
"select exists(select migration from __migrations where migration = $1) as exists",
|
||||
)
|
||||
.bind(migration.to_string())
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.expect("Failed to check migration table");
|
||||
|
||||
let exists: bool = row.get("exists");
|
||||
|
||||
exists
|
||||
sqlx::query("select exists(select migration from __migrations where migration = $1) as exists")
|
||||
.bind(migration.to_string())
|
||||
.try_map(|row: PgRow| row.try_get("exists"))
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.expect("Failed to check migration table")
|
||||
}
|
||||
|
||||
async fn save_applied_migration(pool: &mut PgConnection, migration: &str) {
|
||||
|
||||
Reference in New Issue
Block a user