From 3ef5c1aa0bf20d27b00c1f74371f68b2434421dc Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Tue, 28 Mar 2023 19:51:20 +0100 Subject: [PATCH] add FLUSH command --- databaseReset.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/databaseReset.py b/databaseReset.py index dcbc5a3..1be77c9 100644 --- a/databaseReset.py +++ b/databaseReset.py @@ -6,6 +6,8 @@ import sys import time import settings +from django.core.management import call_command +from django.core.management.commands import flush """ Command-line utility for loading cave data files into troggle's database. @@ -124,6 +126,12 @@ def reinit_db(): except: print(f" - - Exception when attempting to: USE {currentdbname}") pass + try: + cmd = flush.Command() + call_command(cmd, verbosity=0, interactive=False) + except: + print(f" - - Exception when attempting to: FLUSH") + pass print(f" - Nuked : {currentdbname}\n") print(" - Migrating: " + django.db.connections.databases["default"]["NAME"])