2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

if db badly corrupt

This commit is contained in:
Philip Sargent 2023-02-01 23:54:26 +00:00
parent 9d1c0ac395
commit 8aa5a601e7

View File

@ -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()
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}")