Skip to content

Commit

Permalink
Merge pull request #43 from besscroft/dev
Browse files Browse the repository at this point in the history
🐛修复 MySQL 不支持初始化的问题
  • Loading branch information
besscroft authored Oct 13, 2023
2 parents 9bee77a + 92d4943 commit 3023199
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public OpenAPI springShopOpenAPI() {
return new OpenAPI()
.info(new Info().title("DiyFile")
.description("一款好看的在线文件列表程序")
.version("v0.8.2")
.version("v0.8.3")
.license(new License().name("MIT license").url("https://github.com/besscroft/diyfile/blob/main/LICENSE")))
.externalDocs(new ExternalDocumentation()
.description("DiyFile 文档")
Expand Down
4 changes: 4 additions & 0 deletions diyfile-system/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-mysql</artifactId>
</dependency>
<!-- aws-java-sdk-s3 -->
<dependency>
<groupId>software.amazon.awssdk</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.flywaydb.core.internal.database.DatabaseType;
import org.flywaydb.core.internal.exception.FlywaySqlException;
import org.flywaydb.core.internal.plugin.PluginRegister;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;

Expand All @@ -37,6 +38,9 @@ public class FlywayConfigure {
private static final List<DatabaseType> SORTED_DATABASE_TYPES = new PluginRegister().getPlugins(DatabaseType.class).stream().sorted().collect(Collectors.toList());
private final ApplicationContext applicationContext;

@Value("${spring.flyway.enabled}")
private Boolean enabled;

@PostConstruct
public void flywayMigrate() {
String datasourceDriveClassName = applicationContext.getEnvironment().getProperty("spring.datasource.driver-class-name");
Expand All @@ -54,6 +58,10 @@ public void flywayMigrate() {
log.info("sqlite 数据库文件已存在,路径:{}", folderPath);
}
}
if (!enabled) {
log.info("flyway 已关闭,跳过初始化...");
return;
}
try {
String databaseProductName = dataSource.getConnection().getMetaData().getDatabaseProductName();
String dbType = databaseProductName.toLowerCase(Locale.ROOT);
Expand Down
12 changes: 8 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.3</version>
<version>3.1.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

Expand All @@ -17,19 +17,19 @@
<packaging>pom</packaging>

<properties>
<revision>0.8.2</revision>
<revision>0.8.3</revision>
<java.version>17</java.version>
<maven.compiler.release>17</maven.compiler.release>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-boot.version>3.1.3</spring-boot.version>
<spring-boot.version>3.1.4</spring-boot.version>
<mapstruct.version>1.5.5.Final</mapstruct.version>
<lombok-mapstruct-binding.version>0.2.0</lombok-mapstruct-binding.version>
<mybatis-plus.version>3.5.3.2</mybatis-plus.version>
<springdoc.version>2.2.0</springdoc.version>
<sa-token.version>1.34.0</sa-token.version>
<sa-token.version>1.36.0</sa-token.version>
<hutool-all.version>5.8.20</hutool-all.version>
<pagehelper.version>1.4.7</pagehelper.version>
<oshi.version>6.4.4</oshi.version>
Expand Down Expand Up @@ -73,6 +73,10 @@
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down

0 comments on commit 3023199

Please sign in to comment.