ferro_cli/commands/
db_status.rs1use console::style;
2use std::path::Path;
3use std::process::Command;
4
5pub fn run() {
6 if !Path::new("src/migrations").exists() {
8 eprintln!(
9 "{} No migrations directory found at src/migrations",
10 style("Error:").red().bold()
11 );
12 eprintln!(
13 "{}",
14 style("Run 'ferro make:migration <name>' to create your first migration.").dim()
15 );
16 std::process::exit(1);
17 }
18
19 println!("{} Checking migration status...", style("->").cyan());
20
21 let status = Command::new("cargo")
23 .args(["run", "--quiet", "--", "db:status"])
24 .status()
25 .expect("Failed to execute cargo command");
26
27 if !status.success() {
28 eprintln!(
29 "{} Failed to get migration status",
30 style("Error:").red().bold()
31 );
32 std::process::exit(1);
33 }
34}