diff --git a/crates/cdk-sql-common/Cargo.toml b/crates/cdk-sql-common/Cargo.toml index ce2a6202..4ceb0903 100644 --- a/crates/cdk-sql-common/Cargo.toml +++ b/crates/cdk-sql-common/Cargo.toml @@ -22,7 +22,6 @@ async-trait.workspace = true cdk-common = { workspace = true, features = ["test"] } bitcoin.workspace = true thiserror.workspace = true -tokio.workspace = true tracing.workspace = true serde.workspace = true serde_json.workspace = true diff --git a/crates/cdk-sql-common/src/common.rs b/crates/cdk-sql-common/src/common.rs index b2962898..325b8443 100644 --- a/crates/cdk-sql-common/src/common.rs +++ b/crates/cdk-sql-common/src/common.rs @@ -21,14 +21,17 @@ pub async fn migrate( // Apply each migration if it hasn’t been applied yet for (name, sql) in migrations { - if let Some((prefix, _)) = name.split_once(['/', '\\']) { + let basename = if let Some((prefix, basename)) = name.split_once(['/', '\\']) { if prefix != db_prefix { continue; } - } + basename + } else { + name + }; let is_missing = query("SELECT name FROM migrations WHERE name = :name")? - .bind("name", name) + .bind("name", basename) .pluck(conn) .await? .is_none();