additionalSchemaInfo lifecycle: for each table THIS run resolves, the run's FK set REPLACES the prior run's entries ("adds new ones, removes old ones that no longer exist" — soft constraints track the CURRENT resolution). Clears the ForeignKeys of every table in targetConfigs so the subsequent MergeSchemaConfig rebuilds them from exactly the current resolution; a table that lost ALL its FKs simply ends clear. Tables NOT in this run keep their entries untouched. (PrimaryKey already has replace semantics in MergeSoftPKs.)
Produce an EmittedFile with the updated additionalSchemaInfo JSON.
Extract soft FK entries from source schema relationships + target configs. Maps source relationship field names → target column names using the target config. FKs point to the natural PK field on target tables (first PK field for composite keys).
Merge new soft FK entries into an existing config. Deduplicates — won't add the same FK twice.
Add soft PK entries for integration tables. Uses the natural PK field name(s) from the source system. Supports composite PKs.
Parse existing additionalSchemaInfo JSON content. Returns empty object if content is empty/null.
Manages soft PK and FK definitions in the additionalSchemaInfo JSON file.