From 857b6c49a347f72602abe9e6738ab2ff84611730 Mon Sep 17 00:00:00 2001 From: Eric Long Date: Tue, 8 Jan 2019 16:52:41 -0500 Subject: [PATCH] 0002904: Parameter to exclude the indexes in table create --- .../org/jumpmind/symmetric/common/ParameterConstants.java | 1 + .../symmetric/service/impl/DataExtractorService.java | 4 ++++ .../src/main/resources/symmetric-default.properties | 7 +++++++ .../src/main/java/org/jumpmind/db/model/Table.java | 4 ++++ 4 files changed, 16 insertions(+) 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 0235da0616..22628b9ef4 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 @@ -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"; diff --git a/symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/DataExtractorService.java b/symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/DataExtractorService.java index 818cce4d30..7328c4cdb8 100644 --- a/symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/DataExtractorService.java +++ b/symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/DataExtractorService.java @@ -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 @@ -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 diff --git a/symmetric-core/src/main/resources/symmetric-default.properties b/symmetric-core/src/main/resources/symmetric-default.properties index 0461e5cc89..11fb8cad84 100644 --- a/symmetric-core/src/main/resources/symmetric-default.properties +++ b/symmetric-core/src/main/resources/symmetric-default.properties @@ -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. # diff --git a/symmetric-db/src/main/java/org/jumpmind/db/model/Table.java b/symmetric-db/src/main/java/org/jumpmind/db/model/Table.java index 311ea074be..76262d6abe 100644 --- a/symmetric-db/src/main/java/org/jumpmind/db/model/Table.java +++ b/symmetric-db/src/main/java/org/jumpmind/db/model/Table.java @@ -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. *