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

本文详细介绍了Flyway数据库迁移工具的配置,包括url、driver、serverId等关键参数,以及schemas、table、locations等选项的用法。内容涵盖Maven插件的configuration节点配置,帮助理解如何定制Flyway的迁移过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

url

YES

The jdbc url to use to connect to the database

driver

NO

Auto-detected based on url

The fully qualified classname of the jdbc driver to use to connect to the database

serverId

NO

flyway-db

The 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.

user

NO

The user to use to connect to the database

password

NO

The password to use to connect to the database

schemas

NO

default schema of the connection

Case-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.

table

NO

schema_version

The 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.

locations

NO

db/migration

Locations 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.

sqlMigrationPrefix

NO

V

The file name prefix for Sql migrations

sqlMigrationSeparator

NO

__

The file name separator for Sql migrations

sqlMigrationSuffix

NO

.sql

The file name suffix for Sql migrations

encoding

NO

UTF-8

The encoding of Sql migrations

placeholderReplacement

NO

true

Whether placeholders should be replaced

placeholders

NO

Placeholders to replace in Sql migrations

placeholderPrefix

NO

${

The prefix of every placeholder

placeholderSuffix

NO

}

The suffix of every placeholder

resolvers

NO

Fully qualified class names of customMigrationResolver implementations to be used in addition to the built-in ones for resolving Migrations to apply.

callbacks

NO

Fully qualified class names ofFlywayCallback implementations to use to hook into the Flyway lifecycle.

target

NO

latest version

The 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.

outOfOrder

NO

false

Allows 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.

validateOnMigrate

NO

true

Whether 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.

cleanOnValidationError

NO

false

Whether 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 !

baselineOnMigrate

NO

false

Whether 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 abovebaselineVersion 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!

baselineVersion

NO

1

The version to tag an existing schema with when executing baseline

baselineDescription

NO

<< Flyway Baseline >>

The description to tag an existing schema with when executing baseline

skip

NO

false

Skips the execution of the plugin for this module

configFile

NO

flyway.properties

Properties 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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值