forked from alexandru-slobodcicov/liquibase-mongodb
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from liquibase/4.4-support
Updated code to work with 4.4.0 release
- Loading branch information
Showing
7 changed files
with
22 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 16 additions & 47 deletions
63
src/main/java/liquibase/ext/mongodb/configuration/MongoConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,31 @@ | ||
package liquibase.ext.mongodb.configuration; | ||
|
||
import liquibase.configuration.AbstractConfigurationContainer; | ||
import liquibase.configuration.AutoloadedConfigurations; | ||
import liquibase.configuration.ConfigurationDefinition; | ||
|
||
import static java.lang.Boolean.TRUE; | ||
|
||
public class MongoConfiguration extends AbstractConfigurationContainer { | ||
public class MongoConfiguration implements AutoloadedConfigurations { | ||
|
||
|
||
public static final String LIQUIBASE_MONGO_NAMESPACE = "liquibase.mongodb"; | ||
public static final String ADJUST_TRACKING_TABLES_ON_STARTUP = "adjustTrackingTablesOnStartup"; | ||
public static final String SUPPORTS_VALIDATOR = "supportsValidator"; | ||
public static final ConfigurationDefinition<Boolean> ADJUST_TRACKING_TABLES_ON_STARTUP; | ||
public static final ConfigurationDefinition<Boolean> SUPPORTS_VALIDATOR; | ||
static { | ||
liquibase.configuration.ConfigurationDefinition.Builder builder = new ConfigurationDefinition.Builder(LIQUIBASE_MONGO_NAMESPACE); | ||
|
||
public MongoConfiguration() { | ||
this(LIQUIBASE_MONGO_NAMESPACE); | ||
} | ||
|
||
/** | ||
* Subclasses must call this constructor passing the namespace, but must themselves provide a no-arg public constructor. | ||
* | ||
* @param namespace - default property prefix | ||
*/ | ||
protected MongoConfiguration(final String namespace) { | ||
|
||
super(namespace); | ||
|
||
getContainer().addProperty(ADJUST_TRACKING_TABLES_ON_STARTUP, Boolean.class) | ||
.setDescription("Enabling this property will validate History Change Log and Log Lock Collections " + | ||
"on Startup and adjust if are not up to date with current release." + | ||
"Worth keeping it disabled and re-enable when upgraded to a new Liquibase version.") | ||
.setDefaultValue(TRUE); | ||
ADJUST_TRACKING_TABLES_ON_STARTUP = builder.define("adjustTrackingTablesOnStartup", Boolean.class) | ||
.setDescription("Enabling this property will validate History Change Log and Log Lock Collections " + | ||
"on Startup and adjust if are not up to date with current release." + | ||
"Worth keeping it disabled and re-enable when upgraded to a new Liquibase version.") | ||
.setDefaultValue(TRUE) | ||
.build(); | ||
|
||
getContainer().addProperty(SUPPORTS_VALIDATOR, Boolean.class) | ||
SUPPORTS_VALIDATOR = builder.define("supportsValidator", Boolean.class) | ||
.setDescription("Disabling this property will let create the Tracking Collections without validators." + | ||
"This will permit usage on Mongo Versions not supporting Validators") | ||
.setDefaultValue(TRUE); | ||
} | ||
|
||
/** | ||
* Adjust DATABASECHANGELOG and DATABASECHANGELOGLOCK on Startup | ||
*/ | ||
public Boolean getAdjustTrackingTablesOnStartup() { | ||
return getContainer().getValue(ADJUST_TRACKING_TABLES_ON_STARTUP, Boolean.class); | ||
} | ||
|
||
public MongoConfiguration setAdjustTrackingTablesOnStartup(final Boolean value) { | ||
getContainer().setValue(ADJUST_TRACKING_TABLES_ON_STARTUP, value); | ||
return this; | ||
} | ||
|
||
/** | ||
* Add Validator to DATABASECHANGELOG and DATABASECHANGELOGLOCK on Creation and Startup Adjustment | ||
*/ | ||
public Boolean getSupportsValidator() { | ||
return getContainer().getValue(SUPPORTS_VALIDATOR, Boolean.class); | ||
} | ||
|
||
public MongoConfiguration setSupportsValidator(final Boolean value) { | ||
getContainer().setValue(SUPPORTS_VALIDATOR, value); | ||
return this; | ||
.setDefaultValue(TRUE) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/main/resources/META-INF/services/liquibase.configuration.AutoloadedConfigurations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
liquibase.ext.mongodb.configuration.MongoConfiguration |
101 changes: 0 additions & 101 deletions
101
src/test/java/liquibase/ext/mongodb/configuration/MongoConfigurationTest.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters