public interface Configuration
| 限定符和类型 | 方法和说明 |
|---|---|
String |
getBaselineDescription()
Retrieves the description to tag an existing schema with when executing baseline.
|
MigrationVersion |
getBaselineVersion()
Retrieves the version to tag an existing schema with when executing baseline.
|
Callback[] |
getCallbacks()
Gets the callbacks for lifecycle notifications.
|
ClassLoader |
getClassLoader()
Retrieves the ClassLoader to use for loading migrations, resolvers, etc from the classpath.
|
int |
getConnectRetries()
The maximum number of retries when attempting to connect to the database.
|
boolean |
getCreateSchemas()
Whether Flyway should attempt to create the schemas specified in the schemas property
|
DataSource |
getDataSource()
Retrieves the dataSource to use to access the database.
|
String |
getDefaultSchema()
The default schema managed by Flyway.
|
OutputStream |
getDryRunOutput()
The stream where to output the SQL statements of a migration dry run.
|
Charset |
getEncoding()
Retrieves the encoding of Sql migrations.
|
String[] |
getErrorOverrides()
Rules for the built-in error handler that let you override specific SQL states and errors codes in order to force
specific errors or warnings to be treated as debug messages, info messages, warnings or errors.
|
String |
getInitSql()
The SQL statements to run to initialize a new database connection immediately after opening it.
|
String |
getInstalledBy()
The username that will be recorded in the schema history table as having applied the migration.
|
ClassProvider<JavaMigration> |
getJavaMigrationClassProvider()
Retrieves the custom ClassProvider to be used to look up
JavaMigration classes. |
JavaMigration[] |
getJavaMigrations()
The manually added Java-based migrations.
|
String |
getLicenseKey()
Your Flyway license key (FL01...).
|
Location[] |
getLocations()
Retrieves the locations to scan recursively for migrations.
|
String |
getPlaceholderPrefix()
Retrieves the prefix of every placeholder.
|
Map<String,String> |
getPlaceholders()
Retrieves the map of <placeholder, replacementValue> to apply to sql migration scripts.
|
String |
getPlaceholderSuffix()
Retrieves the suffix of every placeholder.
|
String |
getRepeatableSqlMigrationPrefix()
Retrieves the file name prefix for repeatable SQL migrations.
|
MigrationResolver[] |
getResolvers()
Retrieves the custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply.
|
ResourceProvider |
getResourceProvider()
Retrieves the custom ResourceProvider to be used to look up resources.
|
String[] |
getSchemas()
The schemas managed by Flyway.
|
String |
getSqlMigrationPrefix()
The file name prefix for versioned SQL migrations.
|
String |
getSqlMigrationSeparator()
Retrieves the file name separator for sql migrations.
|
String[] |
getSqlMigrationSuffixes()
The file name suffixes for SQL migrations.
|
String |
getTable()
Retrieves the name of the schema history table that will be used by Flyway.
|
String |
getTablespace()
The tablespace where to create the schema history table that will be used by Flyway.
|
MigrationVersion |
getTarget()
Gets the target version up to which Flyway should consider migrations.
|
String |
getUndoSqlMigrationPrefix()
The file name prefix for undo SQL migrations.
|
boolean |
isBaselineOnMigrate()
Whether to automatically call baseline when migrate is executed against a non-empty schema with no schema history table.
|
boolean |
isBatch()
Whether to batch SQL statements when executing them.
|
boolean |
isCleanDisabled()
Whether to disable clean.
|
boolean |
isCleanOnValidationError()
Whether to automatically call clean or not when a validation error occurs.
|
boolean |
isGroup()
Whether to group all pending migrations together in the same transaction when applying them (only recommended for databases with support for DDL transactions).
|
boolean |
isIgnoreFutureMigrations()
Ignore future migrations when reading the schema history table.
|
boolean |
isIgnoreIgnoredMigrations()
Ignore ignored migrations when reading the schema history table.
|
boolean |
isIgnoreMissingMigrations()
Ignore missing migrations when reading the schema history table.
|
boolean |
isIgnorePendingMigrations()
Ignore pending migrations when reading the schema history table.
|
boolean |
isMixed()
Whether to allow mixing transactional and non-transactional statements within the same migration.
|
boolean |
isOracleSqlplus()
Whether to Flyway's support for Oracle SQL*Plus commands should be activated.
|
boolean |
isOracleSqlplusWarn()
Whether Flyway should issue a warning instead of an error whenever it encounters an Oracle SQL*Plus statement
it doesn't yet support.
|
boolean |
isOutOfOrder()
Allows migrations to be run "out of order".
|
boolean |
isPlaceholderReplacement()
Checks whether placeholders should be replaced.
|
boolean |
isSkipDefaultCallbacks()
Whether Flyway should skip the default callbacks.
|
boolean |
isSkipDefaultResolvers()
Whether Flyway should skip the default resolvers.
|
boolean |
isStream()
Whether to stream SQL migrations when executing them.
|
boolean |
isValidateMigrationNaming()
Whether to validate migrations and callbacks whose scripts do not obey the correct naming convention.
|
boolean |
isValidateOnMigrate()
Whether to automatically call validate or not when running migrate.
|
boolean |
outputQueryResults()
Whether Flyway should output a table with the results of queries when executing migrations.
|
ClassLoader getClassLoader()
DataSource getDataSource()
int getConnectRetries()
String getInitSql()
null)MigrationVersion getBaselineVersion()
String getBaselineDescription()
MigrationResolver[] getResolvers()
boolean isSkipDefaultResolvers()
Callback[] getCallbacks()
boolean isSkipDefaultCallbacks()
String getSqlMigrationPrefix()
Versioned SQL migrations have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix , which using the defaults translates to V1.1__My_description.sql
String getUndoSqlMigrationPrefix()
Undo SQL migrations are responsible for undoing the effects of the versioned migration with the same version.
They have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix , which using the defaults translates to U1.1__My_description.sql
Flyway Pro and Flyway Enterprise only
String getRepeatableSqlMigrationPrefix()
Repeatable SQL migrations have the following file name structure: prefixSeparatorDESCRIPTIONsuffix , which using the defaults translates to R__My_description.sql
String getSqlMigrationSeparator()
Sql migrations have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix , which using the defaults translates to V1_1__My_description.sql
String[] getSqlMigrationSuffixes()
SQL migrations have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix , which using the defaults translates to V1_1__My_description.sql
Multiple suffixes (like .sql,.pkg,.pkb) can be specified for easier compatibility with other tools such as editors with specific file associations.
JavaMigration[] getJavaMigrations()
boolean isPlaceholderReplacement()
String getPlaceholderSuffix()
String getPlaceholderPrefix()
Map<String,String> getPlaceholders()
MigrationVersion getTarget()
current: designates the current version of the schemalatest: the latest version of the schema, as defined by the migration with the highest versionlatest.latestString getTable()
Retrieves the name of the schema history table that will be used by Flyway.
By default (single-schema mode) the schema history table is placed in the default schema for the connection provided by the datasource.
When the flyway.schemas property is set (multi-schema mode), the schema history table is placed in the first schema of the list.
String getTablespace()
The tablespace where to create the schema history table that will be used by Flyway.
If not specified, Flyway uses the default tablespace for the database connection. This setting is only relevant for databases that do support the notion of tablespaces. Its value is simply ignored for all others.
String getDefaultSchema()
Consequences:
String[] getSchemas()
Consequences:
Charset getEncoding()
Location[] getLocations()
The location type is determined by its prefix.
Unprefixed locations or locations starting with classpath: point to a package on the classpath and may
contain both SQL and Java-based migrations.
Locations starting with filesystem: point to a directory on the filesystem, may only
contain SQL migrations and are only scanned recursively down non-hidden directories.
boolean isBaselineOnMigrate()
Whether to automatically call baseline when migrate is executed against a non-empty schema with no schema history table.
This schema will then be initialized with the baselineVersion before executing the migrations.
Only migrations above baselineVersion will then be applied.
This is useful for initial Flyway production deployments on projects with an existing DB.
Be careful when enabling this as it removes the safety net that ensures Flyway does not migrate the wrong database in case of a configuration mistake!
true if baseline should be called on migrate for non-empty schemas, false if not. (default: false)boolean isOutOfOrder()
If you already have versions 1 and 3 applied, and now a version 2 is found, it will be applied too instead of being ignored.
true if outOfOrder migrations should be applied, false if not. (default: false)boolean isIgnoreMissingMigrations()
true to continue normally and log a warning, false to fail fast with an exception.
(default: false)boolean isIgnoreIgnoredMigrations()
true to continue normally, false to fail fast with an exception.
(default: false)boolean isIgnorePendingMigrations()
true to continue normally, false to fail fast with an exception.
(default: false)boolean isIgnoreFutureMigrations()
true to continue normally and log a warning, false to fail fast with an exception.
(default: true)boolean isValidateMigrationNaming()
false to continue normally, true to fail fast with an exception. (default: false)boolean isValidateOnMigrate()
true if validate should be called. false if not. (default: true)boolean isCleanOnValidationError()
This is exclusively intended as a convenience for development. even though we strongly recommend not to change migration scripts once they have been checked into SCM and run, this provides a way of dealing with this case in a smooth manner. The database will be wiped clean automatically, ensuring that the next migration will bring you back to the state checked into SCM.
Warning ! Do not enable in production !
true if clean should be called. false if not. (default: false)boolean isCleanDisabled()
This is especially useful for production environments where running clean can be quite a career limiting move.
true to disable clean. false to leave it enabled. (default: false)boolean isMixed()
Note that this is only applicable for PostgreSQL, Aurora PostgreSQL, SQL Server and SQLite which all have statements that do not run at all within a transaction.
This is not to be confused with implicit transaction, as they occur in MySQL or Oracle, where even though a DDL statement was run within a transaction, the database will issue an implicit commit before and after its execution.
true if mixed migrations should be allowed. false if an error should be thrown instead. (default: false)boolean isGroup()
true if migrations should be grouped. false if they should be applied individually instead. (default: false)String getInstalledBy()
null for the current database user of the connection. (default: null).String[] getErrorOverrides()
Each error override has the following format: STATE:12345:W.
It is a 5 character SQL state (or * to match all SQL states), a colon,
the SQL error code (or * to match all SQL error codes), a colon and finally
the desired behavior that should override the initial one.
The following behaviors are accepted:
D to force a debug messageD- to force a debug message, but do not show the original sql state and error codeI to force an info messageI- to force an info message, but do not show the original sql state and error codeW to force a warningW- to force a warning, but do not show the original sql state and error codeE to force an errorE- to force an error, but do not show the original sql state and error codeExample 1: to force Oracle stored procedure compilation issues to produce
errors instead of warnings, the following errorOverride can be used: 99999:17110:E
Example 2: to force SQL Server PRINT messages to be displayed as info messages (without SQL state and error
code details) instead of warnings, the following errorOverride can be used: S0001:0:I-
Example 3: to force all errors with SQL error code 123 to be treated as warnings instead,
the following errorOverride can be used: *:123:W
Flyway Pro and Flyway Enterprise only
OutputStream getDryRunOutput()
null if the SQL statements
are executed against the database directly.
Flyway Pro and Flyway Enterprise only
null if the SQL statements are executed against the database directly.boolean isStream()
Flyway Pro and Flyway Enterprise only
true to stream SQL migrations. false to fully loaded them in memory instead. (default: false)boolean isBatch()
Flyway Pro and Flyway Enterprise only
true to batch SQL statements. false to execute them individually instead. (default: false)boolean isOracleSqlplus()
Flyway Pro and Flyway Enterprise only
true to active SQL*Plus support. false to fail fast instead. (default: false)boolean isOracleSqlplusWarn()
Flyway Pro and Flyway Enterprise only
true to issue a warning. false to fail fast instead. (default: false)String getLicenseKey()
Flyway Pro and Flyway Enterprise only
boolean outputQueryResults()
Flyway Pro and Flyway Enterprise only
true to output the results table (default: true)ResourceProvider getResourceProvider()
ClassProvider<JavaMigration> getJavaMigrationClassProvider()
JavaMigration classes. If not set, the default strategy will be used.JavaMigration classes
(default: null)boolean getCreateSchemas()
true)Copyright © 2022. All rights reserved.