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

Attempt fix to MariaDB crash in databasereset

This commit is contained in:
Philip Sargent 2022-07-19 19:48:11 +03:00
parent b79eb9a969
commit 1395ac76e9

View File

@ -24,6 +24,8 @@ todo='''- db Update does not work when a cave id is in the pending list but a pr
- Cannot use Edit This Page for pendingcaves.txt_edit as Edit This Page is expecting an html file.
So we will need a separate file-editing capability just for this configuration file ?!
- crashes on MariaDB on server when deleting Caves and complains Area needs a non null parent, But this is not true.
'''
entrances_xslug = {}
caves_xslug = {}
@ -149,9 +151,19 @@ def readcaves():
with transaction.atomic():
print(" - Deleting Caves and Entrances")
Area.objects.all().delete()
Cave.objects.all().delete()
Entrance.objects.all().delete()
# attempting to avoid MariaDB crash when doing this
try:
Area.objects.all().delete()
except:
pass
try:
Cave.objects.all().delete()
except:
pass
try:
Entrance.objects.all().delete()
except:
pass
# Clear the cave data issues and the caves as we are reloading
DataIssue.objects.filter(parser='areas').delete()
DataIssue.objects.filter(parser='caves').delete()