moved to the correct scripts directory

This commit is contained in:
ObamaTheLlama114
2024-07-26 15:28:23 -05:00
parent 01609cb95c
commit 3eb2f0f917
17 changed files with 0 additions and 0 deletions

View File

@ -0,0 +1,21 @@
use std::{fs::read_to_string, path::PathBuf};
pub fn read_migrate_file(file: PathBuf) -> anyhow::Result<Vec<(PathBuf, PathBuf)>> {
let contents = read_to_string(file)?;
let lines: Vec<String> = contents
.split('\n')
.map(|x| x.to_owned())
.filter(|x| x != "")
.collect();
let migrations = lines
.iter()
.filter_map(|x| x.split_once(" -> "))
.map(|x| {
(
x.0.parse().expect("a valid path"),
x.1.parse().expect("a valid path"),
)
})
.collect::<Vec<_>>();
Ok(migrations)
}