mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-20 22:24:54 +01:00
Changes
1. Fix migration to avoid re-running migration twice 2. Remove tokio dependency
This commit is contained in:
@@ -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