官方文档:https://flywaydb.org/documentation/usage/maven/
flyway需要Maven3.x版本,支持java8及以上版本
flyway具有以下几种功能:
一、migrate
Migrates the schema to the latest version. Flyway will create the schema history table automatically if it doesn’t exist.
二、clean
Drops all objects (tables, views, procedures, triggers, …) in the configured schemas.
The schemas are cleaned in the order specified by the schemas
property.
三、info
Prints the details and status information about all the migrations.
四、validate
Validate applied migrations against resolved ones (on the filesystem or classpath) to detect accidental changes that may prevent the schema(s) from being recreated exactly.
Validation fails if
- differences in migration names, types or checksums are found
- versions have been applied that aren’t resolved locally anymore
- versions have been resolved that haven’t been applied yet
五、undo
Undoes the most recently applied versioned migration.
六、baselinne
Baselines an existing database, excluding all migrations up to and including baselineVersion.
七、repair
Repairs the Flyway schema history table. This will perform the following actions:
- Remove any failed migrations on databases without DDL transactions
(User objects left behind must still be cleaned up manually) - Realign the checksums, descriptions and types of the applied migrations with the ones of the available migrations