summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-02-01 23:54:26 +0000
committerPhilip Sargent <philip.sargent@gmail.com>2023-02-01 23:54:26 +0000
commit8aa5a601e71703f79a9efffbf4f9b3932a6f84f9 (patch)
tree9230554de21f659ee83f5b35f45636545573e1fa
parent9d1c0ac395a5509d577cb030148e335b1ee2b5c8 (diff)
downloadtroggle-8aa5a601e71703f79a9efffbf4f9b3932a6f84f9.tar.gz
troggle-8aa5a601e71703f79a9efffbf4f9b3932a6f84f9.tar.bz2
troggle-8aa5a601e71703f79a9efffbf4f9b3932a6f84f9.zip
if db badly corrupt
-rw-r--r--databaseReset.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/databaseReset.py b/databaseReset.py
index 01d000a..0131329 100644
--- a/databaseReset.py
+++ b/databaseReset.py
@@ -103,7 +103,10 @@ def reinit_db():
# this is now completely failing to nuke MariaDB adequately, and it crashes when creating Area objects with a no null parent message
# when null parents are explciitly allowed in the model.
cursor = django.db.connection.cursor()
- cursor.execute(f"DROP DATABASE {currentdbname}")
+ try:
+ cursor.execute(f"DROP DATABASE {currentdbname}")
+ except:
+ pass
cursor.execute(f"CREATE DATABASE {currentdbname}")
cursor.execute(f"ALTER DATABASE {currentdbname} CHARACTER SET=utf8")
cursor.execute(f"USE {currentdbname}")