Browse Source

perf: Use truncate instead of drop

Changed DML DROP statements to use DDL TRUNCATE for better performance
wherever possible
version-14
Gavin D'souza 4 years ago
parent
commit
a836b2de0c
2 changed files with 4 additions and 4 deletions
  1. +1
    -1
      frappe/core/doctype/error_log/error_log.py
  2. +3
    -3
      frappe/utils/install.py

+ 1
- 1
frappe/core/doctype/error_log/error_log.py View File

@@ -20,4 +20,4 @@ def set_old_logs_as_seen():
def clear_error_logs(): def clear_error_logs():
'''Flush all Error Logs''' '''Flush all Error Logs'''
frappe.only_for('System Manager') frappe.only_for('System Manager')
frappe.db.delete("Error Log")
frappe.db.truncate("Error Log")

+ 3
- 3
frappe/utils/install.py View File

@@ -111,9 +111,9 @@ def before_tests():
# don't run before tests if any other app is installed # don't run before tests if any other app is installed
return return


frappe.db.delete("Custom Field")
frappe.db.delete("Event")
frappe.db.commit()
frappe.db.truncate("Custom Field")
frappe.db.truncate("Event")
frappe.clear_cache() frappe.clear_cache()


# complete setup if missing # complete setup if missing


Loading…
Cancel
Save