use crate::Generator;
pub fn generate(g: &mut Generator) -> Result<(), String> {
generate_with(g, &[])
}
pub fn generate_with(g: &mut Generator, mappings: &[&str]) -> Result<(), String> {
if !g.exists("migration/src/lib.rs") {
return Err(
"Run this from the root of a Loco app (migration/src/lib.rs not found).".into(),
);
}
for mapping in mappings {
match mapping.split_once(':') {
Some(("message", model)) if !model.is_empty() => {}
_ => return Err(format!("Unknown model mapping: {mapping}")),
}
}
g.note("\n Nothing to upgrade: RustLLM 2.1.1 is the first release of this schema.");
g.note(" `rust-llm generate install` creates it.");
Ok(())
}