# Copyright (c) 2020, InfluxFramework LLC
# License: MIT. See LICENSE

import influxframework
from influxframework.model.utils.rename_field import rename_field


def execute():
	"""
	Change notification recipient fields from email to receiver fields
	"""
	influxframework.reload_doc("Email", "doctype", "Notification Recipient")
	influxframework.reload_doc("Email", "doctype", "Notification")

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