Reputation: 225
After reading the SymmetricDS userguide I'm not sure if SymmetricDS supports conflict resolution which is not based on PK but exclusively on my own custom columns.
Given the following scenario:
products
which must be synchronizedNow, the table schema looks like this (simplified):
id (pk) | name (char) | reference (char)
What I would like to know is, is it possible to define the column reference
as identifier for conflict resolution and insert / update operations instead of the pk column id
?
Example:
Node0
id (pk) | name (char) | reference (char)
1 Foo IN001
2 FooBaz IN003
----
Node1
id (pk) | name (char) | reference (char)
1 Bar EX001
2 Foo IN001
Changes on row 2 in Node1 will trigger updates on row 1 in Node 1 while creating a new record in Node0/1 will trigger an insert in the respective node but considering that the PK might be already taken.
Furthermore I would like to filter the to be synchronized table rows by the value of column reference
. Which means that only rows should by synced where reference startwith('IN') == True
.
Thanks!
Upvotes: 1
Views: 995
Reputation: 526
Look at the column 'SYNC_KEY_NAMES' on the TRIGGER table.
Specify a comma-delimited list of columns that should be used as the key for synchronization operations. By default, if not specified, then the primary key of the table will be used.
If you insert the value 'name' into this column, SDS will handle it as the PK.
Leaving id as a PK creates a hurdle. If this column auto-increments, you can try to exclude it in the trigger table column, 'EXCLUDED_COLUMN_NAMES'. Since this is the PK, I don't know if SDS will ignore it or not.
If that does not work you will have to write a Custom Load Filter to increment the id field on insert.
Upvotes: 2