Skip to content
Snippets Groups Projects
Commit e2415c00 authored by David Douard's avatar David Douard
Browse files

Add a --(non-)interactive flag to the `swh db upgrade` command

so it can be used in a script (e.g. docker entrypoint).
parent f40adde2
No related branches found
No related tags found
1 merge request!256Add a --non-interactive flag to the `swh db upgrade` command
......@@ -323,8 +323,13 @@ def db_version(ctx, module, show_all):
metavar="VERSION",
default=None,
)
@click.option(
"--interactive/--non-interactive",
help="Do not ask questions (use default answer to all questions)",
default=True,
)
@click.pass_context
def db_upgrade(ctx, module, to_version):
def db_upgrade(ctx, module, to_version, interactive):
"""Upgrade the database for given module (to a given version if specified).
Examples::
......@@ -360,7 +365,7 @@ def db_upgrade(ctx, module, to_version):
fg="yellow",
bold=True,
)
if not click.confirm(
if interactive and not click.confirm(
f"Write the module information ({module}) in the database?", default=True
):
raise click.BadParameter("Migration aborted.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment