import xhiveframework
from xhiveframework.model.rename_doc import rename_doc


def execute():
	if xhiveframework.db.table_exists("Email Alert Recipient") and not xhiveframework.db.table_exists(
		"Notification Recipient"
	):
		rename_doc("DocType", "Email Alert Recipient", "Notification Recipient")
		xhiveframework.reload_doc("email", "doctype", "notification_recipient")

	if xhiveframework.db.table_exists("Email Alert") and not xhiveframework.db.table_exists("Notification"):
		rename_doc("DocType", "Email Alert", "Notification")
		xhiveframework.reload_doc("email", "doctype", "notification")
