seitime-frappe/frappe/patches/v13_0/replace_old_data_import.py
Suraj Shetty c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30

20 lines
600 B
Python

# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import frappe
def execute():
if not frappe.db.table_exists("Data Import"):
return
meta = frappe.get_meta("Data Import")
# if Data Import is the new one, return early
if meta.fields[1].fieldname == "import_type":
return
frappe.db.sql("DROP TABLE IF EXISTS `tabData Import Legacy`")
frappe.rename_doc("DocType", "Data Import", "Data Import Legacy")
frappe.db.commit()
frappe.db.sql("DROP TABLE IF EXISTS `tabData Import`")
frappe.rename_doc("DocType", "Data Import Beta", "Data Import")