Package io.micronaut.flyway
Class FlywayConfigurationProperties
java.lang.Object
io.micronaut.flyway.FlywayConfigurationProperties
- All Implemented Interfaces:
io.micronaut.core.util.Toggleable
@Context
@EachProperty("flyway.datasources")
public class FlywayConfigurationProperties
extends Object
implements io.micronaut.core.util.Toggleable
Create a Flyway Configuration for each sub-property of flyway.*.
- Since:
- 1.0.0
- Author:
- Iván López
- See Also:
-
FluentConfiguration
-
Field Summary
Modifier and TypeFieldDescriptionstatic final boolean
static final boolean
static final boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.flywaydb.core.api.configuration.FluentConfiguration
The password of the database to migrate.getUrl()
The JDBC url of the database to migrate.getUser()
The user of the database to migrate.boolean
Whether there is an alternative database configuration for the migration.boolean
isAsync()
Whether the flyway migrations should run asynchronously.boolean
Whether Flyway will clean the schema before running the migrations.boolean
void
setAsync
(boolean async) Whether flyway migrations should run asynchronously.void
setBaselineVersion
(String baselineVersion) The version to tag an existing schema with when executing baseline.void
setCleanSchema
(boolean cleanSchema) Set whether Flyway will clean the schema before running the migrations.void
setDryRunOutput
(String dryRunOutputFileName) Sets the dry run output filename.void
setEnabled
(boolean enabled) Set whether this flyway configuration is enabled.void
setEncoding
(String encoding) Sets the encoding of SQL migrations.void
setIgnoreMigrationPatterns
(String... ignoreMigrationPatterns) Sets the migration patterns to ignore.void
setLocations
(String... locations) Sets the locations to scan recursively for migrations.void
setPassword
(String password) void
setProperties
(Map<String, String> properties) void
Sets the target version up to which Flyway should consider migrations.void
void
void
setUsername
(String username)
-
Field Details
-
DEFAULT_ENABLED
public static final boolean DEFAULT_ENABLED- See Also:
-
DEFAULT_ASYNC
public static final boolean DEFAULT_ASYNC- See Also:
-
DEFAULT_CLEAN_SCHEMA
public static final boolean DEFAULT_CLEAN_SCHEMA- See Also:
-
-
Constructor Details
-
FlywayConfigurationProperties
- Parameters:
name
- The name qualifier.
-
-
Method Details
-
getNameQualifier
- Returns:
- The qualifier associated with this flyway configuration
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabled
in interfaceio.micronaut.core.util.Toggleable
-
setEnabled
public void setEnabled(boolean enabled) Set whether this flyway configuration is enabled. Default value (true).- Parameters:
enabled
- true if it is enabled
-
isAsync
public boolean isAsync()Whether the flyway migrations should run asynchronously. Default value: false.- Returns:
- Whether the flyway migrations should run asynchronously
-
setAsync
public void setAsync(boolean async) Whether flyway migrations should run asynchronously.- Parameters:
async
- true to run flyway migrations asynchronously
-
isCleanSchema
public boolean isCleanSchema()Whether Flyway will clean the schema before running the migrations. Default value (false).- Returns:
- Whether clean the schema before running the migrations
-
setCleanSchema
public void setCleanSchema(boolean cleanSchema) Set whether Flyway will clean the schema before running the migrations. Default value (false).- Parameters:
cleanSchema
- true to clean the schema before running the migrations.
-
getUrl
The JDBC url of the database to migrate.- Returns:
- JDBC url of the database to migrate
-
setUrl
- Parameters:
url
- The JDBC url of the database to migrate
-
getUser
The user of the database to migrate.- Returns:
- The user of the database to migrate
-
setUser
- Parameters:
user
- The user of the database to migrate
-
setUsername
- Parameters:
username
- The username of the database to migrate
-
getPassword
The password of the database to migrate.- Returns:
- The password of the database to migrate
-
setPassword
- Parameters:
password
- The password of the database to migrate
-
hasAlternativeDatabaseConfiguration
public boolean hasAlternativeDatabaseConfiguration()Whether there is an alternative database configuration for the migration. By default, Micronaut framework will use theDataSource
defined for the application but if bothurl
anduser
are defined, then those will be used for Flyway.- Returns:
- true if there is an alternative database configuration
-
getFluentConfiguration
public org.flywaydb.core.api.configuration.FluentConfiguration getFluentConfiguration()- Returns:
- The flyway configuration builder
-
setProperties
public void setProperties(@MapFormat(transformation=FLAT,keyFormat=CAMEL_CASE) Map<String, String> properties) - Parameters:
properties
- The properties to be set- See Also:
-
- Flyway parameters. Sets the extra flyway parameters to be passed to FluentConfiguration#configuration(Map). WARNING: This will override any existing configuration properties with the same names.
-
getProperties
- Returns:
- The extra custom properties
- See Also:
-
- Flyway parameters. Gets the extra flyway parameters to be passed to FluentConfiguration#configuration(Map).
-
setDryRunOutput
Sets the dry run output filename.- Parameters:
dryRunOutputFileName
- The dry run output filename- See Also:
-
FluentConfiguration.dryRunOutput(String)
-
setIgnoreMigrationPatterns
Sets the migration patterns to ignore.- Parameters:
ignoreMigrationPatterns
- The migration patterns to ignore- See Also:
-
FluentConfiguration.ignoreMigrationPatterns(String...)
-
setLocations
Sets the locations to scan recursively for migrations.- Parameters:
locations
- The locations to scan for migrations- See Also:
-
FluentConfiguration.locations(String...)
-
setEncoding
Sets the encoding of SQL migrations.- Parameters:
encoding
- The encoding of SQL migrations- See Also:
-
FluentConfiguration.encoding(String)
-
setTarget
Sets the target version up to which Flyway should consider migrations.- Parameters:
target
- The target version- See Also:
-
FluentConfiguration.target(String)
-
setBaselineVersion
The version to tag an existing schema with when executing baseline. Passes through toFluentConfiguration.baselineVersion(String)
- Parameters:
baselineVersion
- The version to tag an existing schema with when executing baseline.
-