修复53数据库异常
This commit is contained in:
@@ -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 创建的列。
|
||||
Reference in New Issue
Block a user