新增内容: - 添加 flyway-core 依赖 (Spring Boot 2.7 管理版本 8.5.x) - 新增 FlywayConfig.java — 适配动态数据源,手动指定主数据源 - 排除 FlywayAutoConfiguration,使用自定义配置 - application-dev.yml 添加 spring.flyway 配置 - baseline-on-migrate: true (对现有表建立基线) - baseline-version: 0 - locations: classpath:db/migration - 新增 db/migration/V1__baseline_marker.sql 基线标记 - 新增 db/migration/README.md 使用说明 验证结果: - ✅ flyway_schema_history 表已创建 - ✅ 基线 (version=0) 已建立 - ✅ V1 迁移已执行 - ✅ 服务正常启动 使用方式: 后续新增表或修改表结构,在 db/migration/ 创建 V2__xxx.sql, V3__xxx.sql 等文件,启动时 Flyway 自动执行
135 lines
4.4 KiB
XML
Executable File
135 lines
4.4 KiB
XML
Executable File
<?xml version="1.0" encoding="UTF-8"?>
|
||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||
<parent>
|
||
<groupId>com.openhis</groupId>
|
||
<artifactId>openhis-server</artifactId>
|
||
<version>0.0.1-SNAPSHOT</version>
|
||
</parent>
|
||
|
||
<modelVersion>4.0.0</modelVersion>
|
||
<artifactId>openhis-application</artifactId>
|
||
<version>0.0.1-SNAPSHOT</version>
|
||
|
||
<description>
|
||
应用
|
||
</description>
|
||
|
||
<dependencies>
|
||
|
||
<dependency>
|
||
<groupId>org.springframework.boot</groupId>
|
||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||
</dependency>
|
||
|
||
<!-- Flyway 数据库迁移 -->
|
||
<dependency>
|
||
<groupId>org.flywaydb</groupId>
|
||
<artifactId>flyway-core</artifactId>
|
||
</dependency>
|
||
|
||
<dependency>
|
||
<groupId>org.projectlombok</groupId>
|
||
<artifactId>lombok</artifactId>
|
||
</dependency>
|
||
|
||
<!-- Spring 配置 -->
|
||
<dependency>
|
||
<groupId>org.springframework.boot</groupId>
|
||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||
<optional>true</optional>
|
||
</dependency>
|
||
|
||
<!-- 领域-->
|
||
<dependency>
|
||
<groupId>com.openhis</groupId>
|
||
<artifactId>openhis-domain</artifactId>
|
||
<version>0.0.1-SNAPSHOT</version>
|
||
</dependency>
|
||
|
||
<!-- liteflow-->
|
||
<dependency>
|
||
<groupId>com.yomahub</groupId>
|
||
<artifactId>liteflow-spring-boot-starter</artifactId>
|
||
<version>2.12.4.1</version>
|
||
</dependency>
|
||
|
||
<!-- junit-->
|
||
<dependency>
|
||
<groupId>junit</groupId>
|
||
<artifactId>junit</artifactId>
|
||
<scope>test</scope>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>com.alibaba</groupId>
|
||
<artifactId>fastjson</artifactId>
|
||
<version>2.0.43</version>
|
||
<scope>compile</scope>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>org.apache.httpcomponents</groupId>
|
||
<artifactId>httpclient</artifactId>
|
||
</dependency>
|
||
|
||
<dependency>
|
||
<groupId>org.apache.velocity</groupId>
|
||
<artifactId>velocity-engine-core</artifactId>
|
||
</dependency>
|
||
|
||
<!-- rabbitMQ -->
|
||
<!-- <dependency>
|
||
<groupId>org.springframework.boot</groupId>
|
||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||
</dependency> -->
|
||
|
||
</dependencies>
|
||
|
||
<build>
|
||
<plugins>
|
||
<plugin>
|
||
<groupId>org.springframework.boot</groupId>
|
||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||
<version>2.5.15</version>
|
||
<configuration>
|
||
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
||
</configuration>
|
||
<executions>
|
||
<execution>
|
||
<goals>
|
||
<goal>repackage</goal>
|
||
</goals>
|
||
</execution>
|
||
</executions>
|
||
</plugin>
|
||
<plugin>
|
||
<groupId>org.apache.maven.plugins</groupId>
|
||
<artifactId>maven-war-plugin</artifactId>
|
||
<version>3.1.0</version>
|
||
<configuration>
|
||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||
<warName>${project.artifactId}</warName>
|
||
</configuration>
|
||
</plugin>
|
||
<plugin>
|
||
<groupId>org.apache.maven.plugins</groupId>
|
||
<artifactId>maven-compiler-plugin</artifactId>
|
||
<version>3.13.0</version>
|
||
<configuration>
|
||
<source>17</source>
|
||
<target>17</target>
|
||
<encoding>UTF-8</encoding>
|
||
<annotationProcessorPaths>
|
||
<path>
|
||
<groupId>org.projectlombok</groupId>
|
||
<artifactId>lombok</artifactId>
|
||
<version>${lombok.version}</version>
|
||
</path>
|
||
</annotationProcessorPaths>
|
||
</configuration>
|
||
</plugin>
|
||
</plugins>
|
||
<finalName>${project.artifactId}</finalName>
|
||
</build>
|
||
|
||
</project>
|