Exporting Document Links to your Custom App

I am facing a brick wall with this problem.

One of my Frappe Apps relies on ERPNext and hrms, essentially, it expands the limited features of hrms.

Obviously, this required me to create additional fields in some underlying doctypes, which I did, using the GUI and then exporting the customizations to the my app (Also using the gui).

That works fine and has not caused any major headaches, but what I am trying to achieve is create Document Links in an ERPNext doctype (Employee).

They work fine on my dev system and I can see them exported to the app/workspace/custom/employee.json file, however when I install my app (or update it, or migrate) on another bench, the Document Links are not added.

As my linked documents form an integral part of the Employee lifecycle, and users are generally not smart, I view this ability as critical.

Am I missing something simple or is this functionality just non-existent in version-15?

So the solution I ended up using was to create a setup script and run it before_migrate in hooks.py:

line for hooks.py:

before_migrate = [
	"ir.setup.add_employee_doclinks.ensure_employee_links"
]

contents of apps/ir/ir/setup/add_employee_doclinks.py

import frappe

def ensure_employee_links():
    """Ensure required Document Links exist in the Employee DocType."""
    required_links = [
        {"link_doctype": "Disciplinary Action", "link_fieldname": "accused"},
        {"link_doctype": "Contract of Employment", "link_fieldname": "employee"},
        {"link_doctype": "Incapacity Proceedings", "link_fieldname": "accused"},
        {"link_doctype": "Appeal Against Outcome", "link_fieldname": "employee"}
    ]

    # Fetch existing links
    existing_links = frappe.get_all(
        "DocType Link",
        filters={"parent": "Employee"},
        fields=["link_doctype", "link_fieldname"]
    )

    existing_links_set = {(link["link_doctype"], link["link_fieldname"]) for link in existing_links}

    for link in required_links:
        if (link["link_doctype"], link["link_fieldname"]) not in existing_links_set:
            doc = frappe.get_doc({
                "doctype": "DocType Link",
                "parent": "Employee",
                "parentfield": "links",
                "parenttype": "DocType",
                "link_doctype": link["link_doctype"],
                "link_fieldname": link["link_fieldname"],
                "group": "Industrial Relations"
            })
            doc.insert(ignore_permissions=True)
            frappe.db.commit()
            frappe.msgprint(f"Added missing Document Link: {link['link_doctype']} to Employee")

    print("✅ Employee Document Links verified/updated.")