Customize Form Deployment

I’m having trouble deploying changes made with Customize Form to already running systems.
Even though the sync_on_migrate flag is set to 1, the changes are not being applied when running bench migrate.

Has anyone else experienced this issue, or are there known workarounds?

I found that resetting the customizations for the Doctype before migrating seems to work. Currently, I’m handling this with a patch:

from frappe.custom.doctype.customize_form.customize_form import reset_customization

def execute():
    reset_customization("someDocType")

This works reliably and even handles deleted custom fields correctly (at least from the UI perspective—they remain in the database).

My questions are:

1. Is this a legitimate approach, or could it cause problems down the road?

2. Why isn’t this behavior the default? From what I’ve read, many people face issues with deleted custom fields. Couldn’t the framework check whether the custom fields are still needed in the database and clean them up in a similar way? Or am I misunderstanding something?

3. What’s the difference between using the Export Customizations action and directly exporting the created Custom Field documents as fixtures?

Links regarding this topic

Unfortunately, up to my knowledge, there is no way to delete custom fields on migrate. You may use a patch script whenever you delete a custom field to apply the change to all your other sites.