2025-05-20 11:54:15 +07:00
|
|
|
use std::error::Error;
|
|
|
|
|
use std::process::Command;
|
|
|
|
|
|
|
|
|
|
fn run_seed(bin: &str) -> Result<(), Box<dyn Error>> {
|
|
|
|
|
println!("🔧 Seeding: {bin}");
|
|
|
|
|
let status = Command::new("cargo").args(["run", "--bin", bin]).status()?;
|
|
|
|
|
|
|
|
|
|
if !status.success() {
|
|
|
|
|
Err(format!("❌ Failed to run seed: {bin}").into())
|
|
|
|
|
} else {
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn main() -> Result<(), Box<dyn Error>> {
|
|
|
|
|
println!("🚀 Running all seeders...\n");
|
|
|
|
|
|
|
|
|
|
run_seed("seed_permissions")?;
|
|
|
|
|
run_seed("seed_roles")?;
|
|
|
|
|
run_seed("seed_roles_permissions")?;
|
|
|
|
|
run_seed("seed_users")?;
|
2025-05-26 14:11:17 +07:00
|
|
|
run_seed("seed_events")?;
|
2025-05-20 11:54:15 +07:00
|
|
|
|
|
|
|
|
println!("\n✅ All seeding completed successfully.");
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|