Files
junhong_cmp_fiber/migrations/000166_create_system_config.up.sql
break 17782d5f8e
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m20s
实现七月迭代公共技术基础
2026-07-23 17:52:48 +09:00

23 lines
1020 B
SQL

-- 创建受控系统配置表;具体业务 Key 由所属业务模块注册,不在公共迁移中预置。
CREATE TABLE tb_system_config (
id bigserial PRIMARY KEY,
config_key varchar(150) NOT NULL,
config_value text NOT NULL,
value_type varchar(20) NOT NULL,
module varchar(100) NOT NULL,
description varchar(500) NOT NULL,
is_readonly boolean NOT NULL DEFAULT false,
is_sensitive boolean NOT NULL DEFAULT false,
creator bigint NOT NULL DEFAULT 0,
updater bigint NOT NULL DEFAULT 0,
created_at timestamptz NOT NULL DEFAULT NOW(),
updated_at timestamptz NOT NULL DEFAULT NOW(),
CONSTRAINT uq_system_config_key UNIQUE (config_key),
CONSTRAINT ck_system_config_value_type CHECK (value_type IN ('string', 'int', 'bool', 'json'))
);
CREATE INDEX idx_system_config_module_key ON tb_system_config (module, config_key);
COMMENT ON TABLE tb_system_config IS '受控系统配置表';
COMMENT ON COLUMN tb_system_config.value_type IS '值类型 string/int/bool/json';