mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-02-08 07:28:45 +00:00
MariaDB fix thanks to Google gemini
This commit is contained in:
@@ -11,6 +11,7 @@ from datetime import date, datetime, timezone
|
||||
from pathlib import Path
|
||||
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db import connection
|
||||
|
||||
import troggle.settings as settings
|
||||
from troggle.core.models.caves import Cave, Entrance, GetCaveLookup
|
||||
@@ -731,8 +732,7 @@ class LoadingSurvex:
|
||||
print(message, file=sys.stderr)
|
||||
stash_data_issue(
|
||||
parser="survex",
|
||||
message=message,
|
||||
url=None,
|
||||
message=message
|
||||
)
|
||||
qms = []
|
||||
for blk in self._pending_qm_saves:
|
||||
@@ -743,11 +743,18 @@ class LoadingSurvex:
|
||||
except Exception as e:
|
||||
pass
|
||||
raise
|
||||
|
||||
bulk_kwargs = {
|
||||
"update_conflicts": True,
|
||||
"update_fields": ['block', 'cave', 'blockname', 'grade', 'number', 'expoyear'],
|
||||
}
|
||||
|
||||
# MariaDB/MySQL do not support (and don't need) unique_fields here
|
||||
if connection.vendor != 'mysql':
|
||||
bulk_kwargs["unique_fields"] = ['cave', 'blockname', 'grade', 'number', 'expoyear']
|
||||
|
||||
try:
|
||||
QM.objects.bulk_create(qms,
|
||||
update_conflicts=True,
|
||||
unique_fields=['cave', 'blockname', 'grade', 'number', 'expoyear'],
|
||||
update_fields=['block', 'cave', 'blockname', 'grade', 'number', 'expoyear'] )
|
||||
QM.objects.bulk_create(qms, **bulk_kwargs)
|
||||
except Exception as e:
|
||||
pass
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user