feat(db): integrate Flyway migration for BladeX and martial tables

- Add V0__bladex_init.sql with full BladeX schema and data
- Replace V1__baseline.sql with V1__martial_tables_init.sql
- Update V6, V7 to idempotent operations (check column exists)
- Add database backup files for safety
- Remove minio_data from git tracking

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
2026-01-22 11:18:10 +08:00
co-authored by factory-droid[bot]
parent 49b153a651
commit a7b2f9bb5d
43 changed files with 6559 additions and 17 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
-1
View File
@@ -1 +0,0 @@
{"version":"1","format":"xl-single","id":"7aa712c5-97fa-4608-aafd-5e91b82dcaaa","xl":{"version":"3","this":"a0620b80-1f59-4689-8995-4d5bcde4044d","sets":[["a0620b80-1f59-4689-8995-4d5bcde4044d"]],"distributionAlgo":"SIPMOD+PARITY"}}
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -1,12 +0,0 @@
-- =====================================================
-- Flyway 基线脚本
-- 版本: V1
-- 描述: 记录当前数据库结构基线,不执行任何操作
-- 日期: 2024-12-29
-- =====================================================
-- 此脚本作为基线版本,用于标记已有数据库的初始状态
-- 由于 baseline-on-migrate: trueFlyway 会自动将此版本标记为已执行
-- 后续的迁移脚本从 V2 开始
SELECT 1;
File diff suppressed because it is too large Load Diff
@@ -5,4 +5,16 @@
-- Date: 2026-01-16 -- Date: 2026-01-16
-- ===================================================== -- =====================================================
ALTER TABLE martial_deduction_item ADD COLUMN project_id BIGINT NULL COMMENT '项目ID' AFTER applicable_projects; -- Idempotent: Only add column if not exists
SET @dbname = DATABASE();
SET @tablename = 'martial_deduction_item';
SET @columnname = 'project_id';
SET @preparedStatement = (SELECT IF(
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = @dbname AND TABLE_NAME = @tablename AND COLUMN_NAME = @columnname) > 0,
'SELECT 1',
CONCAT('ALTER TABLE ', @tablename, ' ADD COLUMN ', @columnname, ' BIGINT NULL COMMENT "项目ID"')
));
PREPARE alterIfNotExists FROM @preparedStatement;
EXECUTE alterIfNotExists;
DEALLOCATE PREPARE alterIfNotExists;
@@ -1,3 +1,20 @@
-- Add referee_type column to martial_judge_invite table -- =====================================================
-- This field stores the referee type: 1-Chief Judge, 2-Judge, 3-General Judge -- Migration: Add referee_type to martial_judge_invite
ALTER TABLE martial_judge_invite ADD COLUMN referee_type INT DEFAULT NULL COMMENT '裁判类型:1-主裁判,2-裁判员,3-总裁'; -- Version: V7
-- Description: Add referee type column (1-Chief Judge, 2-Judge, 3-General Judge)
-- Date: 2026-01-20
-- =====================================================
-- Idempotent: Only add column if not exists
SET @dbname = DATABASE();
SET @tablename = 'martial_judge_invite';
SET @columnname = 'referee_type';
SET @preparedStatement = (SELECT IF(
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = @dbname AND TABLE_NAME = @tablename AND COLUMN_NAME = @columnname) > 0,
'SELECT 1',
CONCAT('ALTER TABLE ', @tablename, ' ADD COLUMN ', @columnname, ' INT DEFAULT NULL COMMENT "裁判类型:1-主裁判,2-裁判员,3-总裁"')
));
PREPARE alterIfNotExists FROM @preparedStatement;
EXECUTE alterIfNotExists;
DEALLOCATE PREPARE alterIfNotExists;