0

我想设置以下场景:服务器(postgres)被复制到客户端(mysql)。只有一个方向。我正在尝试使用 symmetricsDS 构建此设置。当我尝试将表模式发送到客户端节点时会出现问题。它总是以:

Cannot add foreign key constraint

我试图.properties为客户设置文件/sds/engines

db.init.sql=@@session.foreign_key_checks=0

我也尝试像这样定义扩展:

insert into sym_extension (EXTENSION_ID, EXTENSION_TYPE, INTERFACE_NAME, NODE_GROUP_ID, ENABLED, EXTENSION_ORDER, EXTENSION_TEXT, CREATE_TIME, LAST_UPDATE_BY, LAST_UPDATE_TIME) values ('disable ref integrity','java','org.jumpmind.symmetric.load.IReloadListener','ALL',1,1,'import org.jumpmind.db.sql.ISqlTransaction;
import org.jumpmind.symmetric.ISymmetricEngine;
import org.jumpmind.symmetric.ext.ISymmetricEngineAware;
import org.jumpmind.symmetric.load.IReloadListener;
import org.jumpmind.symmetric.model.Node;

public class MyReloadListener implements IReloadListener, ISymmetricEngineAware {

    ISymmetricEngine engine;

    @Override
    public void setSymmetricEngine(ISymmetricEngine engine) {
        this.engine = engine;
    }

    @Override
    public void beforeReload(ISqlTransaction transaction, Node node, long loadId) {
        engine.getDataService().insertSqlEvent(transaction, node, "SET FOREIGN_KEY_CHECKS = 0;", true, loadId, "initial load");
    }

    @Override
    public void afterReload(ISqlTransaction transaction, Node node, long loadId) {
        engine.getDataService().insertSqlEvent(transaction, node, "SET FOREIGN_KEY_CHECKS = 1;", true, loadId, "initial load");
    }

}
',{ts '2015-03-09 20:21:02.432'},'no_user',{ts '2015-03-09 20:23:59.098'});

也没有成功。

更新

设置中有选项:

create.table.without.foreign.keys

http://www.symmetricds.org/issues/view.php?id=2282

4

0 回答 0