brotherton-erpnext/patches/june_2013/p06_drop_unused_tables.py
2013-11-20 13:00:28 +05:30

81 lines
1.7 KiB
Python

# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
tables = [
"About Us Team",
"Account Balance",
"Announcement",
"Answer",
"Blog Subscriber",
"Books",
"Call Log",
"Call Log Details",
"Campaign Expense",
"Communication Log",
"Compaint Note",
"Competitor",
"Complaint Detail",
"Desktop Item",
"DocType Label",
"Employee Training",
"Featured Item",
"GL Mapper",
"GL Mapper Detail",
"Holiday Block List",
"Holiday Block List Allow",
"Holiday Block List Date",
"Item Parameter",
"Item Parameter Value",
"Landed Cost Master",
"Landed Cost Master Detail",
"Lead Email CC Detail",
"Lease Agreement",
"Lease Installment",
"Market Segment",
"Multi Ledger Report Detail",
"Naming Series Options",
"Online Contact",
"Order Reconciliation Detail",
"Other Income Detail",
"Partner Target Detail",
"Period",
"Print Style",
"Product",
"Product Group",
"Project Activity",
"Project Activity Update",
"Project Cost Breakup",
"Question",
"RV Detail",
"Related Page",
"SMS Receiver",
"Sales and Purchase Return Item",
"Sandbox",
"Series Detail",
"Service Order Detail",
"Service Quotation Detail",
"Shipping Address",
"State",
"TC Detail",
"Territory Target Detail",
"Timesheet",
"Timesheet Detail",
"Training Session",
"Training Session Details",
"User Setting-Profile",
"User Setting-Role Permission",
"User Setting-Role User",
"Website Product Category",
"Workflow Action Detail",
"Workflow Rule",
"Workflow Rule Detail",
]
webnotes.conn.sql("commit")
all_tables = webnotes.conn.sql_list("show tables")
for t in tables:
if ("tab" + t) in all_tables:
webnotes.conn.sql("drop table `tab%s`" % t)