# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt

from __future__ import unicode_literals
import frappe


def execute():
	if not frappe.db.exists("DocType", "Data Import Beta"):
		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.reload_doc("core", "doctype", "data_import")
	frappe.get_doc("DocType", "Data Import").on_update()
	frappe.delete_doc_if_exists("DocType", "Data Import Beta")

@@ -452,79 +452,29 @@
 e.re
-load_doc(%22core%22, %22doctype%22, %22data_import%22)%0A%09frappe.get
+name
 _doc(
-%22
+'
 DocType
-%22, %22
+', '
 Data
@@ -484,64 +484,17 @@
 port
-%22).on_update()%0A%09frappe.delete_doc_if_exists(%22DocType%22, %22
+ Beta', '
 Data
@@ -500,16 +500,11 @@
 a Import
- Beta%22
+'
 )%0A

Use rename_doc