spring boot integrated flyway
1. Add pom-dependent
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<executions>
<!--当install时会执行migrate-->
<execution>
<phase>generate-sources</phase>
<goals>
<goal>migrate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.39</version>
</dependency>
</dependencies>
<configuration>
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://localhost:3306/first_boot</url>
<user>root</user>
<password>123456</password>
<!--<schemas></schemas>-->
</configuration>
</plugin>
2. Add the resource in the folder db / migration
3. Export sql database migration to the next file created above folder, and rename
V1_XX_XX_XX.sql, attention must be capitalized V1 of V
4. Run mvn flyway: migrate to run sql
mvn flyway:migrate