Skip to content
Permalink
Browse files

0003639: Initial load fails on delete first when router uses the "Use

Source Catalog/Schema" setting
  • Loading branch information...
jumpmind-josh committed Jul 20, 2018
1 parent 590f0c7 commit 3488239210e9a465261181568312e27860f330f2
@@ -437,8 +437,8 @@ protected Table loadTargetTable(DbCompareTables tables, String targetTableNameOv

TriggerRouter triggerRouter = getTriggerRouterFor(tables.getSourceTable());
if (triggerRouter != null) {
catalog = triggerRouter.getTargetCatalog(catalog);
schema = triggerRouter.getTargetSchema(schema);
catalog = triggerRouter.getTargetCatalog(catalog, null);
schema = triggerRouter.getTargetSchema(schema, null);
}
}

@@ -157,17 +157,21 @@ public boolean isRouted(DataEventType event) {
}
}

public String getTargetSchema(String defaultSchema) {
public String getTargetSchema(String defaultSchema, TriggerHistory triggerHistory) {
if (router != null && !StringUtils.isBlank(router.getTargetSchemaName())) {
return router.getTargetSchemaName();
} else if (router != null && router.isUseSourceCatalogSchema() && triggerHistory != null) {
return triggerHistory.getSourceSchemaName();
} else {
return defaultSchema;
}
}

public String getTargetCatalog(String defaultCatalog) {
public String getTargetCatalog(String defaultCatalog, TriggerHistory triggerHistory) {
if (router != null && !StringUtils.isBlank(router.getTargetCatalogName())) {
return router.getTargetCatalogName();
} else if (router != null && router.isUseSourceCatalogSchema() && triggerHistory != null) {
return triggerHistory.getSourceCatalogName();
} else {
return defaultCatalog;
}
@@ -188,8 +192,8 @@ public String getTargetTable(TriggerHistory triggerHistory) {
}

public String qualifiedTargetTableName(TriggerHistory triggerHistory) {
String catalog = getTargetCatalog(null);
String schema = getTargetSchema(null);
String catalog = getTargetCatalog(null, triggerHistory);
String schema = getTargetSchema(null, triggerHistory);
String tableName = getTargetTable(triggerHistory);
if (!StringUtils.isBlank(schema)) {
tableName = schema + "." + tableName;

0 comments on commit 3488239

Please sign in to comment.
You can’t perform that action at this time.