def METHOD_NAME(doctype, old_fieldname, new_fieldname):
	def _get_new_sort_by(report_dict, report, key):
		sort_by = report_dict.get(key) or ""
		if sort_by:
			sort_by = sort_by.split(".")
			if len(sort_by) > 1:
				if sort_by[0] == doctype and sort_by[1] == old_fieldname:
					sort_by = doctype + "." + new_fieldname
					report_dict["updated"] = True
			elif report.ref_doctype == doctype and sort_by[0] == old_fieldname:
				sort_by = doctype + "." + new_fieldname
				report_dict["updated"] = True
			if isinstance(sort_by, list):
				sort_by = ".".join(sort_by)
		return sort_by
	reports = frappe.db.sql(
		"""select name, ref_doctype, json from tabReport
		where report_type = 'Report Builder' and ifnull(is_standard, 'No') = 'No'
		and json like %s and json like %s""",
		("%%%s%%" % old_fieldname, "%%%s%%" % doctype),
		as_dict=True,
	)
	for r in reports:
		report_dict = json.loads(r.json)
		# update filters
		new_filters = []
		if report_dict.get("filters"):
			for f in report_dict.get("filters"):
				if f and len(f) > 1 and f[0] == doctype and f[1] == old_fieldname:
					new_filters.append([doctype, new_fieldname, f[2], f[3]])
					report_dict["updated"] = True
				else:
					new_filters.append(f)
		# update columns
		new_columns = []
		if report_dict.get("columns"):
			for c in report_dict.get("columns"):
				if c and len(c) > 1 and c[0] == old_fieldname and c[1] == doctype:
					new_columns.append([new_fieldname, doctype])
					report_dict["updated"] = True
				else:
					new_columns.append(c)
		# update sort by
		new_sort_by = _get_new_sort_by(report_dict, r, "sort_by")
		new_sort_by_next = _get_new_sort_by(report_dict, r, "sort_by_next")
		if report_dict.get("updated"):
			new_val = json.dumps(
				{
					"filters": new_filters,
					"columns": new_columns,
					"sort_by": new_sort_by,
					"sort_order": report_dict.get("sort_order"),
					"sort_by_next": new_sort_by_next,
					"sort_order_next": report_dict.get("sort_order_next"),
				}
			)
			frappe.db.sql("""update `tabReport` set `json`=%s where name=%s""", (new_val, r.name))