Skip to content

Commit

Permalink
0002282: Add create.table.without.foreign.keys setting that prevents …
Browse files Browse the repository at this point in the history
…foreign keys to be create on target databases
  • Loading branch information
chenson42 committed Apr 23, 2015
1 parent 92518ed commit 673e636
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Expand Up @@ -120,6 +120,7 @@ private ParameterConstants() {
public final static String INITIAL_LOAD_SCHEMA_LOAD_COMMAND = "initial.load.schema.load.command";

public final static String CREATE_TABLE_WITHOUT_DEFAULTS = "create.table.without.defaults";
public final static String CREATE_TABLE_WITHOUT_FOREIGN_KEYS = "create.table.without.foreign.keys";

public final static String STREAM_TO_FILE_ENABLED = "stream.to.file.enabled";
public final static String STREAM_TO_FILE_THRESHOLD = "stream.to.file.threshold.bytes";
Expand Down
Expand Up @@ -1439,6 +1439,7 @@ public CsvData next() {
if (data.getDataEventType() == DataEventType.CREATE && StringUtils.isBlank(data.getCsvData(CsvData.ROW_DATA))) {

boolean excludeDefaults = parameterService.is(ParameterConstants.CREATE_TABLE_WITHOUT_DEFAULTS, false);
boolean excludeForeignKeys = parameterService.is(ParameterConstants.CREATE_TABLE_WITHOUT_FOREIGN_KEYS, false);

/*
* Force a reread of table so new columns are picked up. A create
Expand Down Expand Up @@ -1469,6 +1470,9 @@ public CsvData next() {
}
}
}
if (excludeForeignKeys) {
targetTable.removeAllForeignKeys();
}
data.setRowData(CsvUtils.escapeCsvData(DatabaseXmlUtil.toXml(db)));
}
}
Expand Down
Expand Up @@ -1000,6 +1000,13 @@ dataloader.create.table.alter.to.match.db.case=true
# Type: boolean
create.table.without.defaults=false

# If set to true, when a table's schema is sent to the target database foreign keys will not
# be included.
#
# DatabaseOverridable: true
# Type: boolean
create.table.without.foreign.keys=false

# Indicates that the current value of the row should be recorded in the incoming_error table
#
# DatabaseOverridable: true
Expand Down

0 comments on commit 673e636

Please sign in to comment.