修复53数据库异常

This commit is contained in:
yml2213
2026-08-20 16:23:47 +08:00
parent 9a52b51c89
commit 6e4689edc4
@@ -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 创建的列。