# Copyright (c) 2020, JINGROW and Contributors
# License: MIT. See LICENSE

import jingrow
from jingrow.model.utils.rename_field import rename_field


def execute():
	"""
	Change notification recipient fields from email to receiver fields
	"""
	jingrow.reload_pg("Email", "pagetype", "Notification Recipient")
	jingrow.reload_pg("Email", "pagetype", "Notification")

	rename_field("Notification Recipient", "email_by_document_field", "receiver_by_document_field")
	rename_field("Notification Recipient", "email_by_role", "receiver_by_role")
