SymmetricDS to synchronize tables with foreign key constraint with initial loads

730 views Asked by At

I'm new to SymmetricDS and would like to use it for database sync. between servers.

The simple scenario is that we have a local server as shop node, and a cloud server as registration node. Now in the registration node we have 40 tables with several foreign keys constraints. The steps I followed are below.

  1. Do initial setup at registration node and create all 40 tables.
  2. Insert data into sym_channel, sym_node_group, sym_router, sym_trigger and sym_trigger_router. Basic rule here is to sync. users/roles/products related tables from registration to shop, and sync. sales related information from shop to registration. Note - in current table design, we have FK constraints in sales information, referencing to users (to record the current operator), products (to record the product id and sell price (maybe different against shops)).
  3. Do initial loads against shop node.
  4. Those tables, which is the same with data transfer flow from registration to shop, will be automatically created. However, as the sales related tables, which are sync.ed from shop to registration, will NOT be created automatically. So this will cause error something like below -

2015-06-19 11:32:41,187 WARN [shop-001] [JdbcSqlTemplate] [shop-001-pull-1] Cannot add foreign key constraint. Failed to execute: ALTER TABLE ams_pos_customer_ticket ADD CONSTRAINT fk_customer_ticket FOREIGN KEY (TicketId) REFERENCES ams_pos_ticket (Id)

===========================

I would like to use SymmetricDS to sync. tables schema first, for example, no matter what the data flow sync. to, the schema must be created first which would be the same with registration node. But during my test, it seems that it only could sync. table schema from registration to shop, which is the same with the direction in the sym_router.

If the above is true, then is there any solution for this as I need shop node to sync. all tables first and then follow sym_router to sync. data.

0

There are 0 answers