<plugin> <groupId>org.flywaydb</groupId> <artifactId>flyway-maven-plugin</artifactId> <version>4.2.0</version> <configuration> .... </configuration> </plugin>
Name | Description |
---|---|
migrate | Migrates the database |
clean | Drops all objects in the configured schemas |
info | Prints the details and status information about all the migrations |
validate | Validates the applied migrations against the ones available on the classpath |
baseline | Baselines an existing database, excluding all migrations up to and including baselineVersion |
repair | Repairs the metadata table |
The Flyway Maven plugin can be configured in the following ways:
<plugin> ... <configuration> <user>myUser</user> <password>mySecretPwd</password> <schemas> <schema>schema1</schema> <schema>schema2</schema> <schema>schema3</schema> </schemas> <placeholders> <keyABC>valueXYZ</keyABC> <otherplaceholder>value123</otherplaceholder> </placeholders> </configuration> </plugin>
<project> ... <properties> <!-- Properties are prefixed with flyway. --> <flyway.user>myUser</flyway.user> <flyway.password>mySecretPwd</flyway.password> <!-- List are defined as comma-separated values --> <flyway.schemas>schema1,schema2,schema3</flyway.schemas> <!-- Individual placeholders are prefixed by flyway.placeholders. --> <flyway.placeholders.keyABC>valueXYZ</flyway.placeholders.keyABC> <flyway.placeholders.otherplaceholder>value123</flyway.placeholders.otherplaceholder> </properties> ... </project>
> mvn -Dflyway.configFile=myConfig.properties
Default is flyway.properties
in the same directory as the POM.
Encoding is specified by flyway.encoding
(Default: UTF-8)
flyway.user=myUser flyway.password=mySecretPwd flyway.schemas=schema1,schema2,schema3 flyway.placeholders.keyABC=valueXYZ flyway.placeholders.otherplaceholder=value123
> mvn -Dflyway.user=myUser -Dflyway.schemas=schema1,schema2 -Dflyway.placeholders.keyABC=valueXYZ
System properties override External config file overrides Maven properties override Plugin configuration
Besides configuring credentials through one of the 3 ways described above, it is also possible to externalize them in the Maven settings.xml file:
<settings> <servers> <server> <!-- By default Flyway will look for the server with the id 'flyway-db' --> <!-- This can be customized by configuring the 'serverId' property --> <id>flyway-db</id> <username>myUser</username> <password>mySecretPwd</password> </server> </servers> </settings>