diff --git a/symmetric-core/src/main/java/org/jumpmind/symmetric/common/ParameterConstants.java b/symmetric-core/src/main/java/org/jumpmind/symmetric/common/ParameterConstants.java index ccb9d38d40..1bfbf5e4fc 100644 --- a/symmetric-core/src/main/java/org/jumpmind/symmetric/common/ParameterConstants.java +++ b/symmetric-core/src/main/java/org/jumpmind/symmetric/common/ParameterConstants.java @@ -99,6 +99,8 @@ private ParameterConstants() { public final static String AUTO_CONFIGURE_EXTRA_TABLES = "auto.config.extra.tables.ddlutil.xml"; public final static String AUTO_UPDATE_NODE_VALUES = "auto.update.node.values.from.properties"; + public final static String INITIAL_LOAD_BEFORE_SQL = "initial.load.before.sql"; + public final static String INITIAL_LOAD_AFTER_SQL = "initial.load.after.sql"; public final static String INITIAL_LOAD_DELETE_BEFORE_RELOAD = "initial.load.delete.first"; public final static String INITIAL_LOAD_DELETE_FIRST_SQL = "initial.load.delete.first.sql"; public final static String INITIAL_LOAD_CREATE_SCHEMA_BEFORE_RELOAD = "initial.load.create.first"; diff --git a/symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/DataService.java b/symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/DataService.java index 01cee55a3a..e55f86a186 100644 --- a/symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/DataService.java +++ b/symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/DataService.java @@ -20,6 +20,8 @@ */ package org.jumpmind.symmetric.service.impl; +import static org.apache.commons.lang.StringUtils.isNotBlank; + import java.sql.DataTruncation; import java.sql.Types; import java.util.ArrayList; @@ -368,8 +370,13 @@ public void insertReloadEvents(Node targetNode, boolean reverse) { insertLoadBatchesForReload(targetNode, loadId, createBy, triggerHistories, triggerRoutersByHistoryId, transactional, transaction); - insertFileSyncBatchForReload(targetNode, loadId, createBy, transactional, transaction); + String afterSql = parameterService.getString(ParameterConstants.INITIAL_LOAD_AFTER_SQL); + if (isNotBlank(afterSql)) { + insertSqlEvent(transaction, targetNode, afterSql, true, loadId, createBy); + } + insertFileSyncBatchForReload(targetNode, loadId, createBy, transactional, transaction); + callReloadListeners(false, targetNode, transactional, transaction); if (!reverse) { @@ -451,6 +458,15 @@ private void insertSqlEventsPriorToReload(Node targetNode, String nodeIdRecord, tablePrefix, engine.getNodeService().findIdentityNodeId()), true, loadId, createBy); } + + String beforeSql = parameterService.getString(ParameterConstants.INITIAL_LOAD_BEFORE_SQL); + if (isNotBlank(beforeSql)) { + insertSqlEvent( + transaction, + targetNode, + beforeSql, true, + loadId, createBy); + } } private void insertCreateBatchesForReload(Node targetNode, long loadId, String createBy, diff --git a/symmetric-core/src/main/resources/symmetric-default.properties b/symmetric-core/src/main/resources/symmetric-default.properties index 8f2c88e76d..cf873345e0 100644 --- a/symmetric-core/src/main/resources/symmetric-default.properties +++ b/symmetric-core/src/main/resources/symmetric-default.properties @@ -479,6 +479,18 @@ initial.load.extract.timeout.ms=7200000 # Type: boolean initial.load.concat.csv.in.sql.enabled=false +# This is SQL that will run on the client before an initial load starts. +# +# DatabaseOverridable: true +# Tags: load +initial.load.before.sql= + +# This is SQL that will run on the client after an initial load finishes. +# +# DatabaseOverridable: true +# Tags: load +initial.load.after.sql= + # If this is true, registration is opened automatically for nodes requesting it. # # DatabaseOverridable: true