fix(model): fix postgres compatibility in update_user_settings
In Postgres, double quotes denote identifiers. The previous LIKE clause format caused "UndefinedColumn" errors during field renaming (e.g., during HRMS installation) because the pattern was interpreted as a column name. This change parameterizes the LIKE pattern and passes the wildcarded value as a bound parameter, ensuring compatibility with both MySQL and Postgres.
This commit is contained in:
parent
5df262350f
commit
12efd72cc9
1 changed files with 3 additions and 3 deletions
|
|
@ -166,9 +166,9 @@ def update_user_settings(doctype, old_fieldname, new_fieldname):
|
|||
sync_user_settings()
|
||||
|
||||
user_settings = frappe.db.sql(
|
||||
''' select user, doctype, data from `__UserSettings`
|
||||
where doctype=%s and data like "%%%s%%"''',
|
||||
(doctype, old_fieldname),
|
||||
""" select user, doctype, data from `__UserSettings`
|
||||
where doctype=%s and data like %s""",
|
||||
(doctype, f"%{old_fieldname}%"),
|
||||
as_dict=1,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue