From 6e4689edc4fd60fc003ec06b0e55dfff587d5808 Mon Sep 17 00:00:00 2001 From: yml2213 Date: Thu, 20 Aug 2026 16:23:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D53=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...al_disbursement_custom_category_repair.sql | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 backend/migrations/000055_manual_disbursement_custom_category_repair.sql diff --git a/backend/migrations/000055_manual_disbursement_custom_category_repair.sql b/backend/migrations/000055_manual_disbursement_custom_category_repair.sql new file mode 100644 index 0000000..a127d05 --- /dev/null +++ b/backend/migrations/000055_manual_disbursement_custom_category_repair.sql @@ -0,0 +1,24 @@ +-- +goose Up + +-- 本地历史数据库可能已占用 000053 版本但未包含该字段,此迁移负责补齐。 +-- +goose StatementBegin +SET @custom_category_column_exists = ( + SELECT COUNT(*) + FROM information_schema.columns + WHERE table_schema = DATABASE() + AND table_name = 'manual_disbursements' + AND column_name = 'custom_category_name' +); +SET @custom_category_sql = IF( + @custom_category_column_exists = 0, + 'ALTER TABLE manual_disbursements ADD COLUMN custom_category_name VARCHAR(50) NOT NULL DEFAULT '''' COMMENT ''自定义出款分类名称''', + 'SELECT 1' +); +PREPARE custom_category_statement FROM @custom_category_sql; +EXECUTE custom_category_statement; +DEALLOCATE PREPARE custom_category_statement; +-- +goose StatementEnd + +-- +goose Down + +-- 补偿迁移不删除字段,避免回滚时误删由 000053 创建的列。