From a560ade64cb6b4af60ea2b8e67b11e87352e0286 Mon Sep 17 00:00:00 2001 From: mediabot-pt <295750538+mediabot-pt@users.noreply.github.com> Date: Sun, 5 Jul 2026 21:43:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Flyway=E7=89=88=E6=9C=AC=E5=8F=B7V3?= =?UTF-8?q?=E2=86=92V15=E5=8C=B9=E9=85=8D=E5=BD=93=E5=89=8DSchema=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...dConfigTables.java => V15__AddConfigTables.java} | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) rename par-core/src/main/java/com/par/core/db/migration/{V3__AddConfigTables.java => V15__AddConfigTables.java} (83%) diff --git a/par-core/src/main/java/com/par/core/db/migration/V3__AddConfigTables.java b/par-core/src/main/java/com/par/core/db/migration/V15__AddConfigTables.java similarity index 83% rename from par-core/src/main/java/com/par/core/db/migration/V3__AddConfigTables.java rename to par-core/src/main/java/com/par/core/db/migration/V15__AddConfigTables.java index 4b28a17..a68ad83 100644 --- a/par-core/src/main/java/com/par/core/db/migration/V3__AddConfigTables.java +++ b/par-core/src/main/java/com/par/core/db/migration/V15__AddConfigTables.java @@ -5,22 +5,14 @@ import org.flywaydb.core.api.migration.Context; import java.sql.Statement; -/** - * Flyway V3:新增配置表和字段 - * - sites 表增加 tags 列 - * - site_pages 表 - * - risk_rules 表 - */ -public class V3__AddConfigTables extends BaseJavaMigration { +public class V15__AddConfigTables extends BaseJavaMigration { @Override public void migrate(Context context) throws Exception { Statement stmt = context.getConnection().createStatement(); - // 站点标签 stmt.execute("ALTER TABLE sites ADD COLUMN IF NOT EXISTS tags JSON NULL COMMENT '标签列表' AFTER description"); - // 站点页面配置 stmt.execute("CREATE TABLE IF NOT EXISTS site_pages (" + "id BIGINT AUTO_INCREMENT PRIMARY KEY, " + "site_id VARCHAR(64) NOT NULL, " + @@ -31,7 +23,6 @@ public class V3__AddConfigTables extends BaseJavaMigration { "updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, " + "INDEX idx_site_id (site_id, deleted)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4"); - // 风险规则 stmt.execute("CREATE TABLE IF NOT EXISTS risk_rules (" + "id BIGINT AUTO_INCREMENT PRIMARY KEY, " + "site_type VARCHAR(32) NOT NULL, " + @@ -42,6 +33,6 @@ public class V3__AddConfigTables extends BaseJavaMigration { "updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, " + "INDEX idx_site_type (site_type, deleted)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4"); - System.out.println("[Flyway V3] Config tables and tags column created"); + System.out.println("[Flyway V15] tags column + site_pages + risk_rules tables created"); } }