The issue proposes a feature to reduce merge conflicts by splitting fixture exports by DocType.
The issue addresses frequent Git merge conflicts caused by fixture exports being dumped into a single JSON file. The proposed solution introduces an opt-in mechanism to split these exports into directories grouped by DocType, requiring changes to fixture handling logic and ensuring backward compatibility. While the requirements are somewhat clear, the implementation involves cross-cutting changes and handling file-to-folder transitions.
In team environments, bench export-fixtures dumps Custom Field (and Property Setter, etc.) records into a single large JSON file. Because records are added in database insertion order, two developers touching different DocTypes often produce conflicting line positions in the same file — even when their changes are logically independent.
This leads to frequent and unnecessary Git merge conflicts.
Introduce an opt-in mechanism to split fixture exports into a directory structure, where records are grouped by their parent DocType (dt).
hooks.pyfixture_split_by_dt = True
This ensures zero breaking changes for existing apps.
Before:
fixtures/
custom_field.json
After:
fixtures/
custom_field/
sales_order.json
customer.json
If a DocType does not have a dt field, it falls back to the original single-file export.
Updated default ordering in export_json to:
order_by="name asc"
This ensures consistent fixture exports across environments.
frappe/utils/fixtures.pyexport_json_split_by_dt_post_process_fixture_docs helper (extracted from export_json)import_fixtures to support directory-based fixturesfrappe/core/doctype/data_import/data_import.pyexport_json to use shared helpername asc)test_fixture_split_by_dttest_fixture_split_fallback_no_dt_fieldAdd to your app's hooks.py:
fixture_split_by_dt = True
Run:
bench --site [site] export-fixtures
Verify fixtures/ now c
Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!