summaryrefslogtreecommitdiffstats
path: root/databaseReset.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-03-28 19:51:20 +0100
committerPhilip Sargent <philip.sargent@gmail.com>2023-03-28 19:51:20 +0100
commit3ef5c1aa0bf20d27b00c1f74371f68b2434421dc (patch)
tree03c25ce2f86411539c513425d112fa44d28cabd4 /databaseReset.py
parent9a28e93ac605b320a998707542ae409ba235cde1 (diff)
downloadtroggle-3ef5c1aa0bf20d27b00c1f74371f68b2434421dc.tar.gz
troggle-3ef5c1aa0bf20d27b00c1f74371f68b2434421dc.tar.bz2
troggle-3ef5c1aa0bf20d27b00c1f74371f68b2434421dc.zip
add FLUSH command
Diffstat (limited to 'databaseReset.py')
-rw-r--r--databaseReset.py8
1 files changed, 8 insertions, 0 deletions
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"])