SymmetricDS:在表转换中将操作从更新更改为插入/删除

时间:2015-08-06 06:15:41

标签: database synchronization symmetricds

在我的源表上我有一个布尔列,如果布尔值打开,SymmetricDS应该在我的目标表中插入一行。如果它被关闭,它应该(最终)从目标表插入行。

在阅读Documentation这些操作后,无法进行更改。 任何提示我如何使用现有功能构建变通方法?

我当前的设置(对于源代码的更新,它只能插入目标,而不是从FP_HIST中删除)

insert into sym_trigger (TRIGGER_ID, SOURCE_SCHEMA_NAME, SOURCE_TABLE_NAME, CHANNEL_ID, CREATE_TIME, LAST_UPDATE_TIME
, SYNC_ON_INSERT, SYNC_ON_DELETE, SYNC_ON_UPDATE, SYNC_ON_UPDATE_CONDITION) 
VALUES ('eventattendee2fphist', 'webapps_base', 'eventattendee', 'channel_fphist', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP
, 0, 0, 1, 'new.attended AND new.id IN (select eat.id from webapps_base.eventattendee eat JOIN webapps_base.iacontact iac ON eat.fk_person_id = iac.fk_naturalperson_id AND NOT iac.lateregistration AND iac.access_path != ''FP_LATE_REGISTRATION'' JOIN webapps_base.event e ON e.id = eat.fk_event_id JOIN webapps_base.eventtypecatalog et ON et.id = e.fk_eventtypecatalog_id AND et.type = ''FP'' JOIN webapps_base.eventagencyassociations eag ON e.id = eag.fk_event_id JOIN webapps_base.agency ag ON ag.id = eag.fk_agency_id WHERE eat.attended)');

insert into SYM_TRIGGER_ROUTER (trigger_id, router_id, initial_load_order, create_time, LAST_UPDATE_TIME, ENABLED) 
values ('eventattendee2fphist', 'pg2ib', 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 1);

insert into SYM_TRANSFORM_TABLE (
  transform_id, source_node_group_id, target_node_group_id, transform_point, SOURCE_SCHEMA_NAME, source_table_name,
  target_table_name, delete_action, transform_order, column_policy, update_first) 
values ('eventattendee2fphist', 'postgres', 'interbase', 'EXTRACT', 'webapps_base', 'eventattendee',
'FP_HIST', 'DEL_ROW', 1, 'SPECIFIED', 0);

insert into SYM_TRANSFORM_COLUMN (
  transform_id, include_on, target_column_name, source_column_name, pk,
  transform_type, transform_expression, transform_order) 
values ('eventattendee2fphist', '*', 'PVP', 'fk_Person_ID', 1, 'lookup', 'select ident FROM webapps_base.salespartner where fk_person_id = CAST(:fk_Person_ID AS BIGINT)', 1);


insert into SYM_TRANSFORM_COLUMN (
  transform_id, include_on, target_column_name, source_column_name, pk,
  transform_type, transform_expression, transform_order) 
values
('eventattendee2fphist', '*', 'VP',  'id',           0, 'lookup', 'select br.ident from webapps_base.eventattendee eat JOIN webapps_base.iacontact iac ON eat.fk_person_id = iac.fk_naturalperson_id AND NOT iac.lateregistration AND iac.access_path != ''FP_LATE_REGISTRATION'' JOIN webapps_base.salespartner br ON br.id = eat.fk_bringersalespartner_id WHERE eat.id = CAST(:id AS BIGINT)', 2);

insert into SYM_TRANSFORM_COLUMN (
  transform_id, include_on, target_column_name, source_column_name, pk,
  transform_type, transform_expression, transform_order) 
values ('eventattendee2fphist', '*', 'STADT_NR', 'fk_Person_ID', 0, 'lookup', 'select ag.agencynumber FROM webapps_base.salespartner sp join webapps_base.salespartneragencystructure sag on sp.id = sag.fk_salespartner_member join webapps_base.agency ag on ag.id = sag.fk_agency_id where sp.fk_person_id = CAST(:fk_person_id AS BIGINT)', 3);

insert into SYM_TRANSFORM_COLUMN (
  transform_id, include_on, target_column_name, source_column_name, pk,
  transform_type, transform_expression, transform_order) 
values ('eventattendee2fphist', '*', 'DATUM', 'id', 0, 'lookup', 'select e.eventdate FROM webapps_base.eventattendee eat JOIN webapps_base.event e ON e.id = eat.fk_event_id WHERE eat.id = CAST(:id AS BIGINT)', 4);

1 个答案:

答案 0 :(得分:0)

现在我可以通过自己的symmetricDSgithub的分支

进行自我增强