import jingrow
from jingrow.model.rename_pg import rename_pg


def execute():
	if jingrow.db.table_exists("Email Alert Recipient") and not jingrow.db.table_exists(
		"Notification Recipient"
	):
		rename_pg("PageType", "Email Alert Recipient", "Notification Recipient")
		jingrow.reload_pg("email", "pagetype", "notification_recipient")

	if jingrow.db.table_exists("Email Alert") and not jingrow.db.table_exists("Notification"):
		rename_pg("PageType", "Email Alert", "Notification")
		jingrow.reload_pg("email", "pagetype", "notification")
