summaryrefslogtreecommitdiff
path: root/check/commands/phash/drop.py
diff options
context:
space:
mode:
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