chore: remove canonicalize migration
This commit is contained in:
parent
5bdfd6835d
commit
e3ef695069
@ -13,44 +13,6 @@ pub async fn run_migrations(db: &Database) -> Result<(), Box<dyn std::error::Err
|
|||||||
if is_at_version(db, 3).await? {
|
if is_at_version(db, 3).await? {
|
||||||
migrate_to_v4(db).await?;
|
migrate_to_v4(db).await?;
|
||||||
}
|
}
|
||||||
if is_at_version(db, 4).await? {
|
|
||||||
canonicalize_all_problems(db).await?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn canonicalize_all_problems(db: &Database) -> Result<(), Box<dyn std::error::Error>> {
|
|
||||||
tracing::warn!("CANONICALIZING ALL PROBLEMS");
|
|
||||||
|
|
||||||
db.write(|txn| {
|
|
||||||
let mut walls_table = txn.open_table(db::v4::TABLE_WALLS)?;
|
|
||||||
|
|
||||||
let walls_dump = walls_table
|
|
||||||
.iter()?
|
|
||||||
.map(|el| {
|
|
||||||
let (k, v) = el.unwrap();
|
|
||||||
(k.value(), v.value())
|
|
||||||
})
|
|
||||||
.collect::<BTreeMap<_, _>>();
|
|
||||||
|
|
||||||
for (wall_uid, mut wall) in walls_dump.into_iter() {
|
|
||||||
wall.problems = wall
|
|
||||||
.problems
|
|
||||||
.into_iter()
|
|
||||||
.map(|mut problem| {
|
|
||||||
problem.pattern = problem.pattern.canonicalize();
|
|
||||||
problem
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
walls_table.insert(wall_uid, wall)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
})
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user