fix(data_import): only convert link values to lowercase for mariadb

We use a case-insensitive collation there, but PostgreSQL and SQLite are case sensitive

Followup to #33196

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2025-07-10 16:58:19 +05:30
parent b74b8f16b7
commit 0322b014c2
No known key found for this signature in database
GPG key ID: 9DCC61E211BF645F

View file

@ -1035,10 +1035,10 @@ class Column:
if self.df.fieldtype == "Link":
# find all values that dont exist
values = list({cstr(v).lower() for v in self.column_values if v})
transform = (lambda v: cstr(v).lower()) if frappe.db.db_type == "mariadb" else cstr
values = list({transform(v) for v in self.column_values if v})
exists = [
cstr(d.name).lower()
for d in frappe.get_all(self.df.options, filters={"name": ("in", values)})
transform(d.name) for d in frappe.get_all(self.df.options, filters={"name": ("in", values)})
]
not_exists = list(set(values) - set(exists))
if not_exists: