check if Data Migration Plan exists before deleting (#15368)
This commit is contained in:
parent
3cc77b52e7
commit
68000c66fc
@ -6,12 +6,12 @@ def execute():
|
|||||||
for dt, dn in (("Page", "Hub"), ("DocType", "Hub Settings"), ("DocType", "Hub Category")):
|
for dt, dn in (("Page", "Hub"), ("DocType", "Hub Settings"), ("DocType", "Hub Category")):
|
||||||
frappe.delete_doc(dt, dn, ignore_missing=True)
|
frappe.delete_doc(dt, dn, ignore_missing=True)
|
||||||
|
|
||||||
data_migration_plans = frappe.get_all("Data Migration Plan", filters={"module": 'Hub Node'})
|
if frappe.db.exists("DocType", "Data Migration Plan"):
|
||||||
for plan in data_migration_plans:
|
data_migration_plans = frappe.get_all("Data Migration Plan", filters={"module": 'Hub Node'})
|
||||||
plan_doc = frappe.get_doc("Data Migration Plan", plan.name)
|
for plan in data_migration_plans:
|
||||||
for m in plan_doc.get("mappings"):
|
plan_doc = frappe.get_doc("Data Migration Plan", plan.name)
|
||||||
frappe.delete_doc("Data Migration Mapping", m.mapping, force=True)
|
for m in plan_doc.get("mappings"):
|
||||||
frappe.delete_doc("Data Migration Plan", plan.name)
|
frappe.delete_doc("Data Migration Mapping", m.mapping, force=True)
|
||||||
|
frappe.delete_doc("Data Migration Plan", plan.name)
|
||||||
|
|
||||||
frappe.delete_doc("Module Def", "Hub Node", ignore_missing=True)
|
frappe.delete_doc("Module Def", "Hub Node", ignore_missing=True)
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user