perf: Drop name part from posting sort index (#33551)
(cherry picked from commit 8a56df695d)
# Conflicts:
# erpnext/patches.txt
This commit is contained in:
@@ -315,6 +315,11 @@ erpnext.patches.v14_0.fix_crm_no_of_employees
|
||||
erpnext.patches.v14_0.create_accounting_dimensions_in_subcontracting_doctypes
|
||||
erpnext.patches.v14_0.fix_subcontracting_receipt_gl_entries
|
||||
erpnext.patches.v14_0.migrate_remarks_from_gl_to_payment_ledger
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
erpnext.patches.v13_0.update_schedule_type_in_loans
|
||||
erpnext.patches.v13_0.drop_unused_sle_index_parts
|
||||
>>>>>>> 8a56df695d (perf: Drop `name` part from posting sort index (#33551))
|
||||
erpnext.patches.v14_0.create_accounting_dimensions_for_asset_capitalization
|
||||
erpnext.patches.v13_0.update_schedule_type_in_loans
|
||||
erpnext.patches.v14_0.update_partial_tds_fields
|
||||
|
||||
14
erpnext/patches/v13_0/drop_unused_sle_index_parts.py
Normal file
14
erpnext/patches/v13_0/drop_unused_sle_index_parts.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import frappe
|
||||
|
||||
from erpnext.stock.doctype.stock_ledger_entry.stock_ledger_entry import on_doctype_update
|
||||
|
||||
|
||||
def execute():
|
||||
try:
|
||||
frappe.db.sql_ddl("ALTER TABLE `tabStock Ledger Entry` DROP INDEX `posting_sort_index`")
|
||||
except Exception:
|
||||
frappe.log_error("Failed to drop index")
|
||||
return
|
||||
|
||||
# Recreate indexes
|
||||
on_doctype_update()
|
||||
@@ -221,14 +221,9 @@ class StockLedgerEntry(Document):
|
||||
|
||||
|
||||
def on_doctype_update():
|
||||
if not frappe.db.has_index("tabStock Ledger Entry", "posting_sort_index"):
|
||||
frappe.db.commit()
|
||||
frappe.db.add_index(
|
||||
"Stock Ledger Entry",
|
||||
fields=["posting_date", "posting_time", "name"],
|
||||
index_name="posting_sort_index",
|
||||
"Stock Ledger Entry", fields=["posting_date", "posting_time"], index_name="posting_sort_index"
|
||||
)
|
||||
|
||||
frappe.db.add_index("Stock Ledger Entry", ["voucher_no", "voucher_type"])
|
||||
frappe.db.add_index("Stock Ledger Entry", ["batch_no", "item_code", "warehouse"])
|
||||
frappe.db.add_index("Stock Ledger Entry", ["warehouse", "item_code"], "item_warehouse")
|
||||
|
||||
Reference in New Issue
Block a user