Flyway Default Protocol SQL script file The default location is the Db/migration directory under the source folder of the project.
Java code is located by default in the Db.migration package.
The SQL script file and the Java code class name must follow the following naming conventions: V[_][__description].
The number of the version number is between the digits of the decimal point (. ) or underscore (_), separated by a continuous two underscore (__) between the version number and the description.
such as V1_1_0__update.sql.
The Java class name specification does not allow a decimal point, so the number of versions in the Java class name can be delimited by an underscore.
<plugin> <groupId>Com.googlecode.flyway</groupId> <Artifactid>Flyway-maven-plugin</Artifactid> <version>1.7</version> <Dependencies> <Dependency> <groupId>Mysql</groupId> <Artifactid>Mysql-connector-java</Artifactid> <version>${mysql.connector.version}</version> </Dependency> </Dependencies> <Configuration> <Driver>Com.mysql.jdbc.Driver</Driver> <URL>Jdbc:mysql://localhost/flywaydemo?useunicode=true&Characterencoding=utf-8</URL> <User>Root</User> <Password></Password> <!--set up a database that accepts flyway for versioning, with multiple databases separated by commas - <Schemas>Flywaydemo</Schemas> <!--set the name of the table that holds the Flyway metadata data - <Table>Schema_version</Table> <!--set flyway Scan SQL upgrade script, directory path for Java upgrade script, or package path - <Locations> < Location>Flyway/migrations</ Location> < Location>Com.kedacom.flywaydemo.migrations</ Location> </Locations> <!--to set the encoding of a SQL script file - <encoding>UTF-8</encoding> <!--set the validation behavior before performing a migrate operation - <Validationmode>All</Validationmode> <!--set the system behavior when validation fails - <Validationerrormode>FAIL</Validationerrormode> </Configuration> </plugin>
The above plug-in configuration contains several aspects of configuration information:
- Declaring plug-ins
- Declaring a database-driven dependency package
- Flyway Configuration--Database connection Configuration
- Flyway Configuring--flyway parameters and Behavior configuration
Execute the MAVEN command for Flyway operations (several common operations are listed below)
- MVN flyway:init (Initialize Flyway metadata)
- MVN flyway:migrate (perform Flyway upgrade operation)
- MVN flyway:validate (verify flyway data correctness)
http://blog.csdn.net/nydia_lvhq/article/details/51362649
Database version management tool flyway--Basic article