DbObjectMerger - do-/node-doix-db GitHub Wiki

DbObjectMerger is an ObjectMerger descendant used by DbSchemaSource for merging complete database object definitions from their distinct parts presented as files subject to require.

It only overrides the add (a, b, k) method for the sole case k === 'pk' (meaning primary key): if a and b are both defined,

  • either they must be deep strict equal
  • or one must be a 1-element array consisting of the other: e. g. 'id' and ['id']
    • in that case, the array is the result.

So, unlike with base ObjectMerger, an attempt to merge, say, ['dt'] and ['no'] as pk values raises an error instead of resulting in ['dt', 'no'] array.

pk is the only property name special to DbObjectMerger. For all other fields, it behaves like the base class.