Skip to content

Commit dc9fcd6

Browse files
committed
Add cli options to revert and redo all
1 parent 8a70683 commit dc9fcd6

1 file changed

Lines changed: 31 additions & 5 deletions

File tree

diesel_cli/src/cli.rs

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,37 @@ pub fn build_cli() -> App<'static, 'static> {
1818
.setting(AppSettings::VersionlessSubcommands)
1919
.arg(migration_dir_arg())
2020
.subcommand(SubCommand::with_name("run").about("Runs all pending migrations"))
21-
.subcommand(SubCommand::with_name("revert").about("Reverts the latest run migration"))
22-
.subcommand(SubCommand::with_name("redo").about(
23-
"Reverts and re-runs the latest migration. Useful \
24-
for testing that a migration can in fact be reverted.",
25-
))
21+
.subcommand(
22+
SubCommand::with_name("revert")
23+
.about("Reverts the latest run migration")
24+
.arg(
25+
Arg::with_name("REVERT_ALL")
26+
.long("all")
27+
.help("Reverts all migrations")
28+
.long_help(
29+
"When this option is specified all migrations \
30+
will be reverted. Useful for testing your revert \
31+
scripts only.",
32+
)
33+
)
34+
)
35+
.subcommand(
36+
SubCommand::with_name("redo")
37+
.about(
38+
"Reverts and re-runs the latest migration. Useful \
39+
for testing that a migration can in fact be reverted.",
40+
)
41+
.arg(
42+
Arg::with_name("REDO_ALL")
43+
.long("all")
44+
.help("Reverts and re-runs all migrations.")
45+
.long_help(
46+
"When this option is specified all migrations \
47+
will be reverts and re-runs. Useful for testing \
48+
that your migrations can be reverted and applied."
49+
)
50+
)
51+
)
2652
.subcommand(
2753
SubCommand::with_name("list")
2854
.about("Lists all available migrations, marking those that have been applied."),

0 commit comments

Comments
 (0)