Skip to content

Commit 1e6f1de

Browse files
committed
feat: enable refresh & reset through cli
1 parent 219ae69 commit 1e6f1de

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

  • vectorctl-cli/src/commands
  • vectorctl-migration/src

vectorctl-cli/src/commands/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ pub enum MigrateSubcommands {
5151
#[arg(long, required = false)]
5252
to: Option<String>,
5353
},
54+
#[command()]
55+
Refresh,
56+
#[command()]
57+
Reset,
5458
#[command(about = "Get migration status")]
5559
Status,
5660
}
@@ -77,7 +81,9 @@ pub async fn run_migrate_command(
7781
sub @ Some(MigrateSubcommands::Generate { .. })
7882
| sub @ Some(MigrateSubcommands::Up { .. })
7983
| sub @ Some(MigrateSubcommands::Down { .. })
80-
| sub @ Some(MigrateSubcommands::Status) => {
84+
| sub @ Some(MigrateSubcommands::Status)
85+
| sub @ Some(MigrateSubcommands::Refresh)
86+
| sub @ Some(MigrateSubcommands::Reset) => {
8187
let (cmd_str, extra_args) = match sub {
8288
Some(MigrateSubcommands::Generate { name, message }) => ("generate", {
8389
let mut args = vec![name];
@@ -100,6 +106,8 @@ pub async fn run_migrate_command(
100106
.collect(),
101107
),
102108
Some(MigrateSubcommands::Status) => ("status", vec![]),
109+
Some(MigrateSubcommands::Refresh) => ("refresh", vec![]),
110+
Some(MigrateSubcommands::Reset) => ("reset", vec![]),
103111
_ => ("up", vec![]),
104112
};
105113

vectorctl-migration/src/cli.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ where
130130
}
131131
Some(MigrateSubcommands::Up { to }) => M::up(&context, to).await?,
132132
Some(MigrateSubcommands::Down { to }) => M::down(&context, to).await?,
133+
Some(MigrateSubcommands::Refresh) => M::refresh(&context).await?,
134+
Some(MigrateSubcommands::Reset) => M::reset(&context).await?,
133135
Some(MigrateSubcommands::Status) => M::status(&context).await?,
134136
None => M::up(&context, None).await?,
135137
}

0 commit comments

Comments
 (0)