
from __future__ import unicode_literals
import frappe


def execute():
	frappe.db.sql(
		"""INSERT INTO `tabData Import Legacy` SELECT * FROM `tabData Import`"""
	)
	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()


from __future__ import unicode_literals
import frappe


def execute():
	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()

Use rename doc instead of manually moving the data
fix: Use rename doc instead of manually moving the data

  
  from __future__ import unicode_literals
  import frappe
  
  
  def execute():
+ 	frappe.rename_doc('DocType', 'Data Import', 'Data Import Legacy')
- 	frappe.db.sql(
- 		"""INSERT INTO `tabData Import Legacy` SELECT * FROM `tabData Import`"""
- 	)
  	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()
  
Use rename doc instead of manually moving the data
## Code Before:

from __future__ import unicode_literals
import frappe


def execute():
	frappe.db.sql(
		"""INSERT INTO `tabData Import Legacy` SELECT * FROM `tabData Import`"""
	)
	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()

## Instruction:
Use rename doc instead of manually moving the data
## Code After:

from __future__ import unicode_literals
import frappe


def execute():
	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()
