hyapp-server/server/admin/migrations/086_app_config_app_scope.sql
2026-07-10 20:23:43 +08:00

12 lines
919 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;
-- 历史 admin_app_configs 没有租户列,所有 App 共同读取同一行。迁移把这些行保留为 app_code=''
-- 的只读默认基线:未知或未来新增 App 仍能读取原配置,后续写操作只创建当前 App 的 scoped override。
-- 同一个 key 可以同时存在一行 legacy 基线和多行 App override三元唯一键是隔离写入的最终兜底。
ALTER TABLE admin_app_configs
ADD COLUMN app_code VARCHAR(32) NOT NULL DEFAULT '' COMMENT '应用编码;空值仅表示迁移前的只读默认基线' AFTER id,
ADD COLUMN is_deleted BOOLEAN NOT NULL DEFAULT FALSE COMMENT '当前 App 删除墓碑;用于屏蔽默认基线' AFTER description,
DROP INDEX idx_admin_app_config_group_key,
ADD UNIQUE KEY uk_admin_app_config_app_group_key (app_code, `group`, `key`),
ADD KEY idx_admin_app_configs_app_group (app_code, `group`);