fix: don't try to rename a doctype that doesn't exist (#28487)

When migrating a database that doesn't contain a table for "Marketing Campaign" yet (because it was added in a later, in-between version), this patch used to fail. Now we attempt to rename the doctype only if it exists.

The patch was introduced in https://github.com/frappe/frappe/pull/27801
This commit is contained in:
Raffael Meyer 2024-11-16 18:27:05 +01:00 committed by GitHub
parent c3a6f750bb
commit 585dae2053
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,5 +7,9 @@ def execute():
"""
if frappe.db.exists("DocType", "UTM Campaign"):
return
if not frappe.db.exists("DocType", "Marketing Campaign"):
return
frappe.rename_doc("DocType", "Marketing Campaign", "UTM Campaign", force=True)
frappe.reload_doctype("UTM Campaign", force=True)