Skip to content

Commit

Permalink
0002904: Parameter to exclude the indexes in table create
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Jan 8, 2019
1 parent 9a9282e commit 857b6c4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
Expand Up @@ -167,6 +167,7 @@ private ParameterConstants() {

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 CREATE_TABLE_WITHOUT_INDEXES = "create.table.without.indexes";
public final static String CREATE_TABLE_WITHOUT_PK_IF_SOURCE_WITHOUT_PK = "create.table.without.pk.if.source.without.pk";

public final static String CREATE_TABLE_NOT_NULL_COLUMNS = "create.table.not.null.columns.supported";
Expand Down
Expand Up @@ -2441,6 +2441,7 @@ public CsvData next() {

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

/*
* Force a reread of table so new columns are picked up. A create
Expand Down Expand Up @@ -2475,6 +2476,9 @@ public CsvData next() {
if (excludeForeignKeys) {
copyTargetTable.removeAllForeignKeys();
}
if (excludeIndexes) {
copyTargetTable.removeAllIndexes();
}

if (parameterService.is(ParameterConstants.CREATE_TABLE_WITHOUT_PK_IF_SOURCE_WITHOUT_PK, false)
&& sourceTable.getPrimaryKeyColumnCount() == 0
Expand Down
Expand Up @@ -1383,6 +1383,13 @@ create.table.without.defaults=false
# Type: boolean
create.table.without.foreign.keys=false

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

# If set to true, when a table's schema is sent to the target database it will not have all
# columns set as the primary key if the source does not have any primary keys.
#
Expand Down
4 changes: 4 additions & 0 deletions symmetric-db/src/main/java/org/jumpmind/db/model/Table.java
Expand Up @@ -138,6 +138,10 @@ public void removeAllForeignKeys() {
foreignKeys.clear();
}

public void removeAllIndexes() {
indices.clear();
}

/**
* Returns the catalog of this table as read from the database.
*
Expand Down

0 comments on commit 857b6c4

Please sign in to comment.