feat: adjust readme and add new seeder script

This commit is contained in:
Maulana Sodiqin
2025-05-20 11:54:15 +07:00
parent e63658c082
commit 055ef6ac8e
8 changed files with 186 additions and 195 deletions
+25
View File
@@ -0,0 +1,25 @@
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")?;
println!("\n✅ All seeding completed successfully.");
Ok(())
}