From 79f0e696f3f6067a0841a37404fb546dedaa07cb Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 15 Apr 2019 16:26:03 +0200 Subject: cli suite working --- check/commands/phash/drop.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 check/commands/phash/drop.py (limited to 'check/commands/phash/drop.py') diff --git a/check/commands/phash/drop.py b/check/commands/phash/drop.py new file mode 100644 index 0000000..40a8261 --- /dev/null +++ b/check/commands/phash/drop.py @@ -0,0 +1,22 @@ +""" +Drop the database (useful when testing) +""" + +import click +import glob + +from app.models.sql_factory import Base, engine + +@click.command() +@click.option('-f', '--force', 'opt_force', is_flag=True, + help='Actually drop the database') +@click.pass_context +def cli(ctx, opt_force): + """ + Drop the database + """ + if opt_force: + print('Dropping the database...!') + Base.metadata.drop_all(engine) + else: + print('Will foolishly drop the database if the --force flag is passed') \ No newline at end of file -- cgit v1.2.3-70-g09d2