I'm testing SymmetricDS and I'm having some doubt about which approach I should use to synchronize some specific tables. I have two application, the first is a ERP and the second is a PDV. Some tables can be synchronized to all PDV databases, however, in some tables the row should synchronize to a specific PDV instance:
In this diagram, the red rectangles show which table need synchronize, and the green arrow show the column where we can identify which SymmetricDS instance will synchronize. My question is: which approach I should use to do this (bsh, subselect, lookuptable, etc) and how I do it?
You need a subselect router (actually you need three). I only show you the SQL for
Funcionario
, then you'll be able to figure out the configuration forCadastro
andFuncionario_funcao
by yourself:When a record from the
Funcionario
table is routed, this router picks all the nodes withexternal_id
equal to theEmpresa.CNPJ
linked to the givenFuncionario
(I assumedFuncionario.id_cadastro
to be the reference toCadastro.CPFCGC
)Note I used
c.external_id
, but you may want to use c.node_id (depends on what you put intoEmpresa.CNPJ
).