feat: Rückfall wählt die vorher aktive Version, prüft das Schema vor dem Umschalten und bestätigt die Bereitschaft; nexus schema (#1176)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -33,6 +33,7 @@ Aufruf:
|
||||
nexus model list | enable --name N | disable --name N | remove --name N (nur gesperrte Modelle) | discover [--engine llama.cpp|ollama|maya|strata|tts]
|
||||
nexus diag [--out DATEI.tar.gz] [--ohne-engine-logs] Diagnose-Archiv ohne Prompts und Keys
|
||||
nexus backup [--out DATEI.db] Kopie der Datenbank (ohne sie zu migrieren; auch bei laufendem Gateway)
|
||||
nexus schema [--config PFAD] Schema-Version von Programm und Datenbank ausgeben (nur lesend, ohne Migration)
|
||||
nexus help Diese Hilfe
|
||||
|
||||
Die Konfiguration kommt aus --config, sonst NEXUS_CONFIG, sonst ./config.toml, sonst gelten Standardwerte.
|
||||
@ -53,6 +54,7 @@ async fn main() -> ExitCode {
|
||||
Some("model") => admin::model(&args[1..]).await,
|
||||
Some("diag") => diag::command(&args[1..]),
|
||||
Some("backup") => backup(&args[1..]),
|
||||
Some("schema") => schema(&args[1..]),
|
||||
Some("help") | Some("--help") | None => {
|
||||
print!("{HILFE}");
|
||||
ExitCode::SUCCESS
|
||||
@ -106,6 +108,33 @@ fn config_path(args: &[String]) -> Result<Option<PathBuf>, String> {
|
||||
}
|
||||
|
||||
/// `nexus backup`: Kopie der Datenbank, Standard `data_dir/backups/nexus-<zeit>.db`.
|
||||
/// Gibt die Schema-Version des Programms und der Datenbank aus, **nur lesend und ohne Migration** (→ #1176). Das
|
||||
/// Installationsskript prüft damit vor einem Rückfall, ob die Datenbank zum Zielstand passt.
|
||||
fn schema(args: &[String]) -> ExitCode {
|
||||
println!("programm {}", nexus_store::LATEST_SCHEMA_VERSION);
|
||||
let Ok(flags) = cli::Flags::parse(args, &["config"], &[]) else {
|
||||
println!("datenbank unbekannt");
|
||||
return ExitCode::SUCCESS;
|
||||
};
|
||||
let Ok(config) = cli::load_config(&flags) else {
|
||||
println!("datenbank unbekannt");
|
||||
return ExitCode::SUCCESS;
|
||||
};
|
||||
let db = config.db_path();
|
||||
if !db.is_file() {
|
||||
println!("datenbank fehlt");
|
||||
return ExitCode::SUCCESS;
|
||||
}
|
||||
match nexus_store::Store::open_readonly(&db).and_then(|s| s.schema_version()) {
|
||||
Ok(v) => println!("datenbank {v}"),
|
||||
Err(e) => {
|
||||
println!("datenbank unlesbar");
|
||||
eprintln!("{e}");
|
||||
}
|
||||
}
|
||||
ExitCode::SUCCESS
|
||||
}
|
||||
|
||||
fn backup(args: &[String]) -> ExitCode {
|
||||
let run = || -> Result<PathBuf, String> {
|
||||
let flags = cli::Flags::parse(args, &["out", "config"], &[])?;
|
||||
|
||||
Reference in New Issue
Block a user