yeg
2026-09-04 62e7a2f8c86501dbe064ff989938cbb97f12916a
ruoyi-admin/src/main/java/com/ruoyi/config/FlywayMigrationConfig.java
@@ -9,9 +9,9 @@
import org.springframework.context.annotation.Configuration;
/**
 * Runs versioned migrations against the same master datasource used by MyBatis.
 * The application uses a custom Druid datasource, so Spring Boot's standard
 * Flyway auto-configuration is not available here.
 * 在 MyBatis 使用的主数据源上执行版本化迁移。
 *
 * <p>项目使用自定义 Druid 数据源,因此不使用 Spring Boot 默认 Flyway 自动装配。</p>
 */
@Configuration
public class FlywayMigrationConfig
@@ -24,8 +24,8 @@
            throw new IllegalStateException("Flyway requires the configured Druid master datasource");
        }
        Flyway flyway = Flyway.configure()
                // Flyway must not use a pooled Druid connection here. Druid disables
                // the connection when MySQL denies Flyway's optional performance_schema probe.
                // Flyway 直接使用连接参数,避免 MySQL 拒绝可选的 performance_schema 探测后
                // Druid 将池内连接标记为不可用。
                .dataSource(druidDataSource.getUrl(), druidDataSource.getUsername(), druidDataSource.getPassword())
                // 旧迁移链仅作历史保留,新库从最终业务基线初始化。
                .locations("classpath:db/migration-final")
@@ -37,7 +37,7 @@
        return new FlywayMigrationInitializer(flyway);
    }
    /** A small lifecycle bean keeps migration execution explicit and testable. */
    /** 通过独立生命周期 Bean 显式执行迁移,便于验证启动顺序。 */
    public static final class FlywayMigrationInitializer
    {
        private final Flyway flyway;