Package com.adaptris.jdbc.flyway
Class DefaultFlywayMigrator
- java.lang.Object
-
- com.adaptris.jdbc.flyway.DefaultFlywayMigrator
-
- All Implemented Interfaces:
FlywayMigrator
@ComponentProfile(summary="Perform a database migration using flyway", since="3.9.2") public class DefaultFlywayMigrator extends java.lang.Object implements FlywayMigrator
Perform a database migration using flywayIn the adapter configuration file this class is aliased as flyway-jdbc-migrator which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Constructor Summary
Constructors Constructor Description DefaultFlywayMigrator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Boolean
getBaseline()
java.util.List<java.lang.String>
getFlywayLocations()
java.lang.String
getFlywayTable()
void
migrate(javax.sql.DataSource source)
void
setBaseline(java.lang.Boolean baseline)
Whether to automatically call baseline when migrate is executed against a non-empty schema with no schema history table.void
setFlywayLocations(java.util.List<java.lang.String> flywayLocations)
List of locations to scan recursively for migrations.void
setFlywayTable(java.lang.String flywayTable)
Alternative schema history table.DefaultFlywayMigrator
withBaseline(java.lang.Boolean b)
DefaultFlywayMigrator
withFlywayLocations(java.lang.String... locations)
DefaultFlywayMigrator
withFlywayLocations(java.util.List<java.lang.String> locations)
DefaultFlywayMigrator
withFlywayTable(java.lang.String table)
-
-
-
Method Detail
-
migrate
public void migrate(javax.sql.DataSource source) throws java.lang.Exception
- Specified by:
migrate
in interfaceFlywayMigrator
- Throws:
java.lang.Exception
-
getFlywayLocations
public java.util.List<java.lang.String> getFlywayLocations()
-
setFlywayLocations
public void setFlywayLocations(java.util.List<java.lang.String> flywayLocations)
List of locations to scan recursively for migrations.Locations can be prefixed with classpath or filesytem. which means that
filesystem:./sql/
if the files are on the filesystem orclasspath:migration/mysql
if they are on the classpath.- Parameters:
flywayLocations
- the locations.
-
withFlywayLocations
public DefaultFlywayMigrator withFlywayLocations(java.util.List<java.lang.String> locations)
-
withFlywayLocations
public DefaultFlywayMigrator withFlywayLocations(java.lang.String... locations)
-
getBaseline
public java.lang.Boolean getBaseline()
-
setBaseline
public void setBaseline(java.lang.Boolean baseline)
Whether to automatically call baseline when migrate is executed against a non-empty schema with no schema history table.- Parameters:
baseline
- true to baseline, default is false if not explicitly configured.
-
withBaseline
public DefaultFlywayMigrator withBaseline(java.lang.Boolean b)
-
getFlywayTable
public java.lang.String getFlywayTable()
-
setFlywayTable
public void setFlywayTable(java.lang.String flywayTable)
Alternative schema history table.Optional schema history table. If provided flyway history will be created in this table.
- Parameters:
flywayTable
- the table. optional. If not provided will use the default flyway history table
-
withFlywayTable
public DefaultFlywayMigrator withFlywayTable(java.lang.String table)
-
-