You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 4, 2025. It is now read-only.
common: Add new parameter to diff function for specifying merge strategy
This adds a new parameter to the diff function to specify the merge
strategy. This is mostly intended for later use and at the moment does
not do much except for toggling on or off the output of SQL statements
in the generated changeset object.
The way this is meant to be used (without guarantees that this is going
to work) is to use the NoMerge strategy when no merging is intended in
order to save some CPU cycles.
The PreservePkMerge strategy is intended for generating the SQL
statements needed to create database B out of database A in this
scenario:
A --> B
It can also be used when the user needs the primary key of their tables
to be preserved, i.e. when it carries some meaning.
The NewPkMerge strategy generates the same SQL statements except for the
INSERT statements which create new primary keys instead of keeping the
original ones. This is intended for merging databases B and C into
database D in this scenario:
A --> B --> D
\ ^
\--> C ---/
Here the diff between A and C using the NewPkMerge strategy can be
applied on B to create D - at least when conflicting UPDATEs are
handled.
As soon as we implement actual merging we might want to add a function
to guess the merge strategy depending on whether or not the table has a
primary key, it is AUTOINCREMENTing, and it is of type INTEGER or some
similar algorithm and add a "guess" merge strategy here.
This commit also adds support for the new parameter to the API handler.
If no value is provided we default to the "none" merge strategy.
// diffSingleObject compares the object with name objectName and of type objectType in the main and aux schemata of the connection sdb
146
154
// and returns three values: a boolean to indicate whether there are differences, a DiffObjectChangeset object containing all the differences, and an optional error object
0 commit comments