summaryrefslogtreecommitdiff
path: root/check/commands/phash/drop.py
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2019-04-15 16:26:03 +0200
committerJules Laplace <julescarbon@gmail.com>2019-04-15 16:26:03 +0200
commit79f0e696f3f6067a0841a37404fb546dedaa07cb (patch)
treea064f2841dc532f81fcf04eb84300e679fda2b27 /check/commands/phash/drop.py
parente257e83f313a2976347b0a30f58e66b7bcbc1235 (diff)
cli suite working
Diffstat (limited to 'check/commands/phash/drop.py')
-rw-r--r--check/commands/phash/drop.py22
1 files changed, 22 insertions, 0 deletions
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