Database version management tool flyway--Basic article

Source: Internet
Author: User

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&amp;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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.