chore: Add nosemgrep comment to avoid semgrep warnings

This commit is contained in:
Suraj Shetty 2022-01-24 11:00:18 +05:30
parent 9a5409892d
commit 490b2f61cd
2 changed files with 6 additions and 0 deletions

View file

@ -67,6 +67,7 @@ class MariaDBTable(DBTable):
current_column = self.current_columns.get(col.fieldname.lower())
unique_constraint_changed = current_column.unique != col.unique
if unique_constraint_changed and not col.unique:
# nosemgrep
unique_index_record = frappe.db.sql("""
SHOW INDEX FROM `{0}`
WHERE Key_name=%s
@ -77,6 +78,7 @@ class MariaDBTable(DBTable):
index_constraint_changed = current_column.index != col.set_index
# if index key exists
if index_constraint_changed and not col.set_index:
# nosemgrep
index_record = frappe.db.sql("""
SHOW INDEX FROM `{0}`
WHERE Key_name=%s

View file

@ -42,6 +42,7 @@ class PostgresTable(DBTable):
field=col.fieldname
)
if create_index_query:
# nosemgrep
frappe.db.sql(create_index_query)
def alter(self):
@ -118,10 +119,13 @@ class PostgresTable(DBTable):
try:
if query:
final_alter_query = "ALTER TABLE `{}` {}".format(self.table_name, ", ".join(query))
# nosemgrep
frappe.db.sql(final_alter_query)
if create_contraint_query:
# nosemgrep
frappe.db.sql(create_contraint_query)
if drop_contraint_query:
# nosemgrep
frappe.db.sql(drop_contraint_query)
except Exception as e:
# sanitize