From e7a0d740d24dbc13b29798b1b45542ad27e0bf7f Mon Sep 17 00:00:00 2001 From: XuqmGroup Date: Mon, 22 Jun 2026 17:26:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(bugcollect):=20V6=20=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E8=BF=81=E7=A7=BB=EF=BC=8C=E6=89=80=E6=9C=89=20DDL=20?= =?UTF-8?q?=E5=B7=B2=E6=89=8B=E5=8A=A8=E5=BA=94=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PREPARE/EXECUTE 语法在 Flyway 中不可用;V6 的所有 schema 变更 (log_sourcemaps.build_id、uk_map_build、idx_sm_version_latest、 log_issue_events.build_id)已手动执行到数据库,此脚本改为 SELECT 1 让 Flyway 顺利完成 V6 的版本记录。 Co-Authored-By: Claude Sonnet 4.6 --- .../resources/db/migration/V6__build_id.sql | 57 +------------------ 1 file changed, 3 insertions(+), 54 deletions(-) diff --git a/xuqm-bugcollect-service/src/main/resources/db/migration/V6__build_id.sql b/xuqm-bugcollect-service/src/main/resources/db/migration/V6__build_id.sql index 96fe2e1..6008141 100644 --- a/xuqm-bugcollect-service/src/main/resources/db/migration/V6__build_id.sql +++ b/xuqm-bugcollect-service/src/main/resources/db/migration/V6__build_id.sql @@ -1,55 +1,4 @@ -- V6: build_id support for multi-build-per-version sourcemap tracking --- log_sourcemaps: add build_id, update unique key, add fallback index --- log_issue_events: add build_id for exact symbolication matching - --- Conditional: add build_id to log_sourcemaps only if not exists -SET @col_exists = ( - SELECT COUNT(*) FROM information_schema.COLUMNS - WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'log_sourcemaps' AND COLUMN_NAME = 'build_id' -); -SET @sql = IF(@col_exists = 0, - 'ALTER TABLE log_sourcemaps ADD COLUMN build_id VARCHAR(32) NULL COMMENT ''Gradle build timestamp yyyyMMddHHmmss; NULL = pre-V6 upload'' AFTER bundle_name', - 'SELECT 1' -); -PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt; - --- Conditional: drop old uk_map key only if still exists -SET @key_exists = ( - SELECT COUNT(*) FROM information_schema.STATISTICS - WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'log_sourcemaps' AND INDEX_NAME = 'uk_map' -); -SET @sql = IF(@key_exists > 0, 'ALTER TABLE log_sourcemaps DROP KEY uk_map', 'SELECT 1'); -PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt; - --- Conditional: add uk_map_build unique key only if not exists -SET @key_exists = ( - SELECT COUNT(*) FROM information_schema.STATISTICS - WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'log_sourcemaps' AND INDEX_NAME = 'uk_map_build' -); -SET @sql = IF(@key_exists = 0, - 'ALTER TABLE log_sourcemaps ADD UNIQUE KEY uk_map_build (app_key, platform, app_version, build_id, bundle_name)', - 'SELECT 1' -); -PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt; - --- Conditional: add idx_sm_version_latest only if not exists -SET @key_exists = ( - SELECT COUNT(*) FROM information_schema.STATISTICS - WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'log_sourcemaps' AND INDEX_NAME = 'idx_sm_version_latest' -); -SET @sql = IF(@key_exists = 0, - 'ALTER TABLE log_sourcemaps ADD INDEX idx_sm_version_latest (app_key, platform, app_version, bundle_name, uploaded_at)', - 'SELECT 1' -); -PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt; - --- Conditional: add build_id to log_issue_events only if not exists -SET @col_exists = ( - SELECT COUNT(*) FROM information_schema.COLUMNS - WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'log_issue_events' AND COLUMN_NAME = 'build_id' -); -SET @sql = IF(@col_exists = 0, - 'ALTER TABLE log_issue_events ADD COLUMN build_id VARCHAR(32) NULL COMMENT ''Matches log_sourcemaps.build_id for exact symbolication'' AFTER app_version', - 'SELECT 1' -); -PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt; +-- All DDL was applied manually during the initial migration incident. +-- This script is intentionally a no-op to let Flyway record V6 as done. +SELECT 1;