fix(flyway): 重构迁移脚本并修复 WebFlux 环境下无法运行的问题
- 将 15 个分散的迁移脚本合并为 4 个清晰的版本 - V1: 创建所有表结构 - V2: 插入初始数据 - V3: 创建索引 - V4: 授权 - 添加 DataSourceConfig 配置 JDBC DataSource - 添加 spring-boot-starter-jdbc 依赖 - 修复 V2 脚本中 ON CONFLICT 语法问题
This commit was merged in pull request #4.
This commit is contained in:
@@ -70,6 +70,10 @@
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package cn.novalon.gym.manage.app.config;
|
||||
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@Configuration
|
||||
public class DataSourceConfig {
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
@ConfigurationProperties("spring.datasource")
|
||||
public DataSourceProperties dataSourceProperties() {
|
||||
return new DataSourceProperties();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public DataSource dataSource(DataSourceProperties properties) {
|
||||
return properties.initializeDataSourceBuilder()
|
||||
.type(HikariDataSource.class)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user