From 0d30b141c64b7ab04dbb1d68cdc0dcf49ddb9ce0 Mon Sep 17 00:00:00 2001 From: "Fabian P. Schmidt" Date: Tue, 12 Jan 2016 18:36:08 +0100 Subject: [PATCH] CLI: Add command db.drop --- ogn/commands/database.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ogn/commands/database.py b/ogn/commands/database.py index 3cbe882..0f7d0fc 100644 --- a/ogn/commands/database.py +++ b/ogn/commands/database.py @@ -20,6 +20,16 @@ def init(): print("Done.") +@manager.command +def drop(sure='n'): + """Drop all tables.""" + if sure == 'y': + Base.metadata.drop_all(engine) + print('Dropped all tables.') + else: + print("Add argument '--sure y' to drop all tables.") + + @manager.command def import_ddb(): """Import registered devices from the DDB."""