您的位置:首页 > 其它

flyway-Maven插件-configuration节点配置详解

2016-01-11 18:06 387 查看
<configuration>
<driver>org.hsqldb.jdbcDriver</driver>
<url>jdbc:hsqldb:file:${project.build.directory}/db/flyway_sample;shutdown=true</url>
<user>SA</user>
<password>mySecretPwd</password>
<schemas>
<schema>schema1</schema>
<schema>schema2</schema>
<schema>schema3</schema>
</schemas>
<table>schema_history</table>
<locations>
<location>classpath:migrations1</location>
<location>migrations2</location>
<location>filesystem:/sql-migrations</location>
</locations>
<sqlMigrationPrefix>Migration-</sqlMigrationPrefix>
<sqlMigrationSeparator>__</sqlMigrationSeparator>
<sqlMigrationSuffix>-OK.sql</sqlMigrationSuffix>
<encoding>ISO-8859-1</encoding>
<placeholderReplacement>true</placeholderReplacement>
<placeholders>
<aplaceholder>value</aplaceholder>
<otherplaceholder>value123</otherplaceholder>
</placeholders>
<placeholderPrefix>#[</placeholderPrefix>
<placeholderSuffix>]</placeholderSuffix>
<resolvers>
<resolver>com.mycompany.project.CustomResolver</resolver>
<resolver>com.mycompany.project.AnotherResolver</resolver>
</resolvers>
<callbacks>
<callback>com.mycompany.project.CustomCallback</callback>
<callback>com.mycompany.project.AnotherCallback</callback>
</callbacks>
<target>1.1</target>
<outOfOrder>false</outOfOrder>
<validateOnMigrate>true</validateOnMigrate>
<cleanOnValidationError>false</cleanOnValidationError>
<baselineOnMigrate>false</baselineOnMigrate>
<baselineVersion>5</baselineVersion>
<baselineDescription>Let's go!</baselineDescription>
<skip>false</skip>
<configFile>myConfig.properties</configFile>
</configuration>


ParameterRequiredDefaultDescription
urlYESThe jdbc url to use to connect to the database
driverNOAuto-detected based on urlThe fully qualified classname of the jdbc driver to use to connect to the database
serverIdNOflyway-dbThe id of the server in the Maven settings.xml file to load the credentials from.

This is an alternative to passing the credentials in directly through properties.
userNOThe user to use to connect to the database
passwordNOThe password to use to connect to the database
schemasNOdefault schema of the connectionCase-sensitive list of schemas managed by Flyway.
The first schema in the list will be automatically set as the default one during the migration. It will also be the one containing the metadata table.
tableNOschema_versionThe name of Flyway's metadata table.
By default (single-schema mode) the metadata 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 metadata table is placed in the first schema of the list.
locationsNOdb/migrationLocations to scan recursively for migrations. 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 and may only contain sql migrations.
sqlMigrationPrefixNOVThe file name prefix for Sql migrations
sqlMigrationSeparatorNO__The file name separator for Sql migrations
sqlMigrationSuffixNO.sqlThe file name suffix for Sql migrations
encodingNOUTF-8The encoding of Sql migrations
placeholderReplacementNOtrueWhether placeholders should be replaced
placeholdersNOPlaceholders to replace in Sql migrations
placeholderPrefixNO${The prefix of every placeholder
placeholderSuffixNO}The suffix of every placeholder
resolversNOFully qualified class names of customMigrationResolver implementations to be used in addition to the built-in ones for resolving Migrations to apply.
callbacksNOFully qualified class names ofFlywayCallback implementations to use to hook into the Flyway lifecycle.
targetNOlatest versionThe target version up to which Flyway should run migrations. Migrations with a higher version number will not be applied. The string 'current' will be interpreted as MigrationVersion.CURRENT, a placeholder for the latest version that has been applied to the database.
outOfOrderNOfalseAllows migrations to be run "out of order".
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.

validateOnMigrateNOtrueWhether to automatically call validate or not when running migrate.
For each sql migration a CRC32 checksum is calculated when the sql script is executed. The validate mechanism checks if the sql migration in the classpath still has the same checksum as the sql migration already executed in the database.
cleanOnValidationErrorNOfalseWhether to automatically call clean or not when a validation error occurs.

This is exclusively intended as a convenience for development. Even tough 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 !
baselineOnMigrateNOfalseWhether to automatically call baseline when migrate is executed against a non-empty schema with no metadata table. This schema will then be baselined 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!

baselineVersionNO1The version to tag an existing schema with when executing baseline
baselineDescriptionNO<< Flyway Baseline >>The description to tag an existing schema with when executing baseline
skipNOfalseSkips the execution of the plugin for this module
configFileNOflyway.propertiesProperties file from which to load the Flyway configuration. The names of the individual properties match the ones you would use as Maven or System properties. The encoding of the file must be the same as the encoding defined with the flyway.encoding property, which is UTF-8 by default. Relative paths are relative to the POM.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: