[patch] [cleanup] drop unused tables
This commit is contained in:
parent
1894709aa3
commit
a642d59cfd
87
patches/june_2013/p05_remove_unused_doctypes.py
Normal file
87
patches/june_2013/p05_remove_unused_doctypes.py
Normal file
@ -0,0 +1,87 @@
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
doctypes = [
|
||||
"Announcement",
|
||||
"Authorization Rules",
|
||||
"Blog Subscriber",
|
||||
"Books",
|
||||
"Call Log",
|
||||
"Call Log Details",
|
||||
"Campaign Expense",
|
||||
"Communication Log",
|
||||
"Compaint Note",
|
||||
"Company Control",
|
||||
"Competitor",
|
||||
"Complaint Detail",
|
||||
"Desktop Item",
|
||||
"DocType Label",
|
||||
"Employee Training",
|
||||
"Featured Item",
|
||||
"GL Control",
|
||||
"GL Mapper",
|
||||
"GL Mapper Detail",
|
||||
"Holiday Block List",
|
||||
"Holiday Block List Allow",
|
||||
"Holiday Block List Date",
|
||||
"Home Control",
|
||||
"Home Settings",
|
||||
"Item Parameter",
|
||||
"Item Parameter Value",
|
||||
"Lead Email CC Detail",
|
||||
"Manage Account",
|
||||
"Market Segment",
|
||||
"Multi Ledger Report Detail",
|
||||
"Naming Series Options",
|
||||
"Navigation Control",
|
||||
"Online Contact",
|
||||
"Order Reconciliation",
|
||||
"Order Reconciliation Detail",
|
||||
"Other Income Detail",
|
||||
"Partner Target Detail",
|
||||
"Permission Control",
|
||||
"Permission Rules",
|
||||
"Print Style",
|
||||
"Product Catalogue Control",
|
||||
"Product Group",
|
||||
"Product Settings",
|
||||
"Products Settings",
|
||||
"Profile Control",
|
||||
"Project Activity",
|
||||
"Project Activity Update",
|
||||
"Project Control",
|
||||
"Project Cost Breakup",
|
||||
"Related Page",
|
||||
"RV Detail",
|
||||
"Sales Browser Control",
|
||||
"Sandbox",
|
||||
"Search Criteria",
|
||||
"Series Detail",
|
||||
"Shipping Address",
|
||||
"SMS Receiver",
|
||||
"State",
|
||||
"TC Detail",
|
||||
"Territory Target Detail",
|
||||
"Timesheet",
|
||||
"Timesheet Detail",
|
||||
"Top Bar Settings",
|
||||
"Training Session",
|
||||
"Training Session Details",
|
||||
"Transfer Ownership",
|
||||
"Trash Control",
|
||||
"Trend Analyzer Control",
|
||||
"Update Delivery Date",
|
||||
"User Setting-Profile",
|
||||
"User Setting-Role Permission",
|
||||
"User Setting-Role User",
|
||||
"User Settings",
|
||||
"Valuation Control",
|
||||
"Website Product Category",
|
||||
"Workflow Action Detail",
|
||||
"Workflow Engine",
|
||||
"Workflow Rule",
|
||||
"Workflow Rule Detail"
|
||||
]
|
||||
|
||||
for d in doctypes:
|
||||
webnotes.delete_doc("DocType", d)
|
78
patches/june_2013/p06_drop_unused_tables.py
Normal file
78
patches/june_2013/p06_drop_unused_tables.py
Normal file
@ -0,0 +1,78 @@
|
||||
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)
|
@ -242,5 +242,6 @@ patch_list = [
|
||||
"patches.june_2013.p02_update_project_completed",
|
||||
"execute:webnotes.delete_doc('DocType', 'System Console')",
|
||||
"patches.june_2013.p04_fix_event_for_lead_oppty_project",
|
||||
"patches.june_2013.p05_remove_unused_doctypes"
|
||||
"patches.june_2013.p05_remove_unused_doctypes",
|
||||
"patches.june_2013.p06_drop_unused_tables"
|
||||
]
|
@ -62,11 +62,6 @@ def get_todays_events():
|
||||
def get_open_leads():
|
||||
return webnotes.conn.sql("""select count(*) from tabLead
|
||||
where status='Open'""")[0][0]
|
||||
|
||||
def get_unanswered_questions():
|
||||
return len(filter(lambda d: d[0]==0,
|
||||
webnotes.conn.sql("""select (select count(*) from tabAnswer
|
||||
where tabAnswer.question = tabQuestion.name) as answers from tabQuestion""")))
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_global_status_messages(arg=None):
|
||||
@ -76,6 +71,5 @@ def get_global_status_messages(arg=None):
|
||||
'things_todo': get_things_todo(),
|
||||
'todays_events': get_todays_events(),
|
||||
'open_tasks': get_open_tasks(),
|
||||
'unanswered_questions': get_unanswered_questions(),
|
||||
'open_leads': get_open_leads()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user