1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//! Command-line interface definition (clap derive).
use std::path::PathBuf;
use clap::{Parser, Subcommand};
/// Declarative, versioned schema & config migrations for Qdrant.
#[derive(Debug, Parser)]
#[command(name = "revector", version, about, long_about = None)]
pub struct Cli {
/// Path to a `revector.toml` config file (defaults to ./revector.toml).
#[arg(long, global = true, value_name = "FILE")]
pub config: Option<PathBuf>,
/// Qdrant gRPC URL (overrides config / env).
#[arg(long, global = true, env = "REVECTOR_URL")]
pub url: Option<String>,
/// Qdrant API key (overrides config / env).
#[arg(long, global = true, env = "REVECTOR_API_KEY")]
pub api_key: Option<String>,
/// Migrations directory (overrides config / env).
#[arg(long, global = true, value_name = "DIR")]
pub migrations_dir: Option<PathBuf>,
/// Increase log verbosity (-v debug, -vv trace).
#[arg(short, long, global = true, action = clap::ArgAction::Count)]
pub verbose: u8,
#[command(subcommand)]
pub command: Command,
}
#[derive(Debug, Subcommand)]
pub enum Command {
/// Create the migrations directory and a starter config file.
Init,
/// Scaffold a new migration chained onto the current head.
New {
/// Human-readable migration name (used for the slug & description).
name: String,
},
/// Show applied vs pending migrations and any drift in tracking.
Status,
/// Apply pending migrations (optionally up to a specific revision).
Up {
/// Stop after applying this revision.
#[arg(long, value_name = "REV")]
to: Option<String>,
/// Print the plan without mutating Qdrant.
#[arg(long)]
dry_run: bool,
},
/// Roll back applied migrations.
Down {
/// Roll back down to (but not including) this revision.
#[arg(long, value_name = "REV", conflicts_with = "steps")]
to: Option<String>,
/// Number of revisions to roll back (default 1).
#[arg(long, default_value_t = 1)]
steps: usize,
/// Print the plan without mutating Qdrant.
#[arg(long)]
dry_run: bool,
},
/// Migrate to an exact revision, choosing up or down automatically.
To {
/// Target revision id.
revision: String,
/// Print the plan without mutating Qdrant.
#[arg(long)]
dry_run: bool,
},
/// Compare a declared collection spec against the live collection.
Diff {
/// Collection name to inspect.
collection: String,
/// YAML file containing the declared `CollectionSpec`.
#[arg(long, value_name = "FILE")]
spec: PathBuf,
},
}