mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
perf: new column posting datetime in SLE to optimize stock ledger related queries
(cherry picked from commit d80ca523a4)
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.db.sql(
|
||||
"""
|
||||
UPDATE `tabStock Ledger Entry`
|
||||
SET posting_datetime = timestamp(posting_date, posting_time)
|
||||
"""
|
||||
)
|
||||
|
||||
drop_indexes()
|
||||
|
||||
|
||||
def drop_indexes():
|
||||
if not frappe.db.has_index("tabStock Ledger Entry", "posting_sort_index"):
|
||||
return
|
||||
|
||||
frappe.db.sql_ddl("ALTER TABLE `tabStock Ledger Entry` DROP INDEX `posting_sort_index`")
|
||||
Reference in New Issue
Block a user