I would like to setup following scenario: server (postgres) is replicated life to client (mysql). Only one direction. I am trying to build this setup using symmetricsDS. The problem occures when I try to send table schema to client node. It always ends up with:
Cannot add foreign key constraint
I was trying to set in .properties
file for client in /sds/engines
:
db.init.sql=@@session.foreign_key_checks=0
I also tried to define extension like this:
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'});
also without success.
UPDATE:
There is option in settings:
create.table.without.foreign.keys