mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-22 07:04:56 +01:00
Changes
1. Fix migration to avoid re-running migration twice 2. Remove tokio dependency
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -21,14 +21,17 @@ pub async fn migrate<C: DatabaseExecutor>(
|
||||
|
||||
// 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();
|
||||
|
||||
Reference in New Issue
Block a user