aaa
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>${flyway.version}</version>
<executions>
<execution>
<id>flyway-migrate-for-codegen</id>
<phase>generate-sources</phase>
<goals>
<goal>migrate</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- 数据库连接,来自 .env 文件 -->
<url>${DB_URL}</url>
<user>${DB_USER}</user>
<password>${DB_PASSWORD}</password>
<!-- 必须与运行时 FlywayConfig 保持一致 -->
<table>flyway_schema_history</table>
<baselineOnMigrate>true</baselineOnMigrate>
<baselineVersion>0</baselineVersion>
<validateOnMigrate>true</validateOnMigrate>
<!-- 迁移脚本位置,filesystem: 对应 classpath: -->
<locations>
<location>filesystem:${project.basedir}/src/main/resources/db/migration</location>
</locations>
<!-- 本地开发允许 clean,运行时禁止 -->
<cleanDisabled>false</cleanDisabled>
<!-- 编码 -->
<encoding>UTF-8</encoding>
<!-- 出错时不继续 -->
<outOfOrder>false</outOfOrder>
</configuration>
<dependencies>
<!-- 根据你的数据库类型选择 -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.7.3</version>
</dependency>
</dependencies>
</plugin>