mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-02-08 14:37:53 +00:00
MariaDB foibles, try to work around them
This commit is contained in:
@@ -12,6 +12,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
|
from django.db import transaction
|
||||||
|
|
||||||
import troggle.settings as settings
|
import troggle.settings as settings
|
||||||
from troggle.core.models.caves import Cave, Entrance, GetCaveLookup
|
from troggle.core.models.caves import Cave, Entrance, GetCaveLookup
|
||||||
@@ -2334,9 +2335,13 @@ class LoadingSurvex:
|
|||||||
qms_csv = QM.objects.filter(loaded_from_csv=True) # the CSV QMs
|
qms_csv = QM.objects.filter(loaded_from_csv=True) # the CSV QMs
|
||||||
print(f"\n - Currently {len(qms_svx)} survex QMs and {len(qms_csv)} CSV QMs", file=sys.stderr)
|
print(f"\n - Currently {len(qms_svx)} survex QMs and {len(qms_csv)} CSV QMs", file=sys.stderr)
|
||||||
|
|
||||||
self.save_survexblocks_to_db()
|
# Getting round MariaDB foibles: put these in different transactions
|
||||||
self.save_personroles_to_db()
|
with transaction.atomic():
|
||||||
self.save_qms_to_db()
|
self.save_survexblocks_to_db()
|
||||||
|
with transaction.atomic():
|
||||||
|
self.save_personroles_to_db()
|
||||||
|
with transaction.atomic():
|
||||||
|
self.save_qms_to_db()
|
||||||
qms_n = QM.objects.all().count()
|
qms_n = QM.objects.all().count()
|
||||||
print(f" - Now {qms_n} QMs in total", file=sys.stderr)
|
print(f" - Now {qms_n} QMs in total", file=sys.stderr)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user