2024-10-31 15:12:26 +08:00
|
|
|
-- 初始化数据库SCHEMA(所有轨道交通信号系统仿真的表、类型等都在rtsa SCHEMA下)
|
|
|
|
CREATE SCHEMA rtsa;
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-22 17:24:50 +08:00
|
|
|
-- 创建mqtt客户端id序列
|
2024-10-31 15:12:26 +08:00
|
|
|
CREATE SEQUENCE rtsa.mqtt_client_id_seq;
|
2024-10-22 17:24:50 +08:00
|
|
|
|
2024-09-25 18:35:45 +08:00
|
|
|
-- 创建用户表
|
|
|
|
CREATE TABLE
|
2024-10-31 15:12:26 +08:00
|
|
|
rtsa.user (
|
2024-09-25 18:35:45 +08:00
|
|
|
id SERIAL PRIMARY KEY, -- id 自增主键
|
|
|
|
username VARCHAR(128) NOT NULL, -- 用户名
|
|
|
|
password VARCHAR(128) NOT NULL, -- 密码
|
|
|
|
email VARCHAR(128) NULL, -- 邮箱
|
|
|
|
mobile VARCHAR(16) NULL, -- 手机号
|
|
|
|
roles JSONB NOT NULL DEFAULT '[]', -- 角色列表
|
|
|
|
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间
|
|
|
|
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP -- 更新时间
|
|
|
|
);
|
|
|
|
|
2024-09-26 20:45:48 +08:00
|
|
|
-- 创建用户名称索引
|
2024-10-31 15:12:26 +08:00
|
|
|
CREATE INDEX ON rtsa.user (username);
|
2024-09-26 20:45:48 +08:00
|
|
|
|
|
|
|
-- 创建用户邮箱索引
|
2024-10-31 15:12:26 +08:00
|
|
|
CREATE INDEX ON rtsa.user (email);
|
2024-09-26 20:45:48 +08:00
|
|
|
|
|
|
|
-- 创建用户手机号索引
|
2024-10-31 15:12:26 +08:00
|
|
|
CREATE INDEX ON rtsa.user (mobile);
|
2024-09-26 20:45:48 +08:00
|
|
|
|
|
|
|
-- 创建用户角色索引
|
2024-10-31 15:12:26 +08:00
|
|
|
CREATE INDEX ON rtsa.user USING GIN (roles);
|
2024-09-26 20:45:48 +08:00
|
|
|
|
|
|
|
-- 注释用户表
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON TABLE rtsa.user IS '用户表';
|
2024-09-26 20:45:48 +08:00
|
|
|
|
|
|
|
-- 注释用户表字段
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.user.id IS 'id 自增主键';
|
2024-09-26 20:45:48 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.user.username IS '用户名';
|
2024-09-26 20:45:48 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.user.password IS '密码';
|
2024-09-26 20:45:48 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.user.email IS '邮箱';
|
2024-09-26 20:45:48 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.user.mobile IS '手机号';
|
2024-09-26 20:45:48 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.user.roles IS '角色列表';
|
2024-09-26 20:45:48 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.user.created_at IS '创建时间';
|
2024-09-26 20:45:48 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.user.updated_at IS '更新时间';
|
2024-09-26 20:45:48 +08:00
|
|
|
|
2024-09-14 16:45:33 +08:00
|
|
|
-- 创建草稿数据表
|
|
|
|
CREATE TABLE
|
2024-10-31 15:12:26 +08:00
|
|
|
rtsa.draft_data (
|
2024-09-14 16:45:33 +08:00
|
|
|
id SERIAL PRIMARY KEY, -- id 自增主键
|
|
|
|
name VARCHAR(128) NOT NULL, -- 草稿名称
|
|
|
|
data_type INT NOT NULL, -- 数据类型
|
2024-09-19 00:07:53 +08:00
|
|
|
options JSONB NULL, -- 数据相关的参数项或配置项
|
2024-09-14 16:45:33 +08:00
|
|
|
data BYTEA, -- 草稿数据
|
|
|
|
default_release_data_id INT NULL, -- 默认发布数据id
|
|
|
|
user_id INT NOT NULL, -- 创建用户id
|
2024-09-18 15:10:11 +08:00
|
|
|
is_shared BOOLEAN NOT NULL DEFAULT FALSE, -- 是否共享
|
2024-09-19 11:03:05 +08:00
|
|
|
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间
|
|
|
|
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 更新时间
|
2024-10-31 15:12:26 +08:00
|
|
|
FOREIGN KEY (user_id) REFERENCES rtsa.user (id) ON DELETE CASCADE, -- 用户外键
|
2024-09-26 20:45:48 +08:00
|
|
|
UNIQUE (name, data_type, user_id) -- 一个用户的某个类型的草稿名称唯一
|
2024-09-14 16:45:33 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
-- 创建草稿数据用户索引
|
2024-10-31 15:12:26 +08:00
|
|
|
CREATE INDEX ON rtsa.draft_data (user_id);
|
2024-09-14 16:45:33 +08:00
|
|
|
|
|
|
|
-- 创建草稿数据类型索引
|
2024-10-31 15:12:26 +08:00
|
|
|
CREATE INDEX ON rtsa.draft_data (data_type);
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-09-19 00:07:53 +08:00
|
|
|
-- 创建草稿数据配置项索引
|
2024-10-31 15:12:26 +08:00
|
|
|
CREATE INDEX ON rtsa.draft_data USING GIN (options);
|
2024-09-19 00:07:53 +08:00
|
|
|
|
2024-09-14 16:45:33 +08:00
|
|
|
-- 注释草稿数据表
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON TABLE rtsa.draft_data IS '草稿数据表';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
|
|
|
-- 注释草稿数据表字段
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.draft_data.id IS 'id 自增主键';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.draft_data.name IS '草稿名称';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.draft_data.data_type IS '数据类型';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.draft_data.options IS '数据相关的参数项或配置项';
|
2024-09-19 00:07:53 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.draft_data.data IS '草稿数据';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.draft_data.user_id IS '创建用户id';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.draft_data.is_shared IS '是否共享';
|
2024-09-18 15:10:11 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.draft_data.created_at IS '创建时间';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.draft_data.updated_at IS '更新时间';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
|
|
|
-- 创建发布数据表
|
|
|
|
CREATE TABLE
|
2024-10-31 15:12:26 +08:00
|
|
|
rtsa.release_data (
|
2024-09-14 16:45:33 +08:00
|
|
|
id SERIAL PRIMARY KEY, -- id 自增主键
|
2024-09-20 15:45:10 +08:00
|
|
|
name VARCHAR(128) NOT NULL, -- 发布数据名称(数据唯一标识)
|
2024-09-14 16:45:33 +08:00
|
|
|
data_type INT NOT NULL, -- 数据类型
|
2024-09-19 00:07:53 +08:00
|
|
|
options JSONB NULL, -- 数据相关的参数项或配置项
|
2024-09-14 16:45:33 +08:00
|
|
|
used_version_id INT NULL, -- 使用的版本数据id
|
|
|
|
user_id INT NOT NULL, -- 发布/更新用户id
|
|
|
|
is_published BOOLEAN NOT NULL DEFAULT TRUE, -- 是否上架
|
2024-09-19 11:03:05 +08:00
|
|
|
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间
|
2024-09-20 15:45:10 +08:00
|
|
|
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 更新时间
|
2024-10-31 15:12:26 +08:00
|
|
|
FOREIGN KEY (user_id) REFERENCES rtsa.user (id) ON DELETE CASCADE, -- 用户外键
|
2024-09-20 15:45:10 +08:00
|
|
|
UNIQUE(data_type, name) -- 数据类型和名称唯一
|
2024-09-14 16:45:33 +08:00
|
|
|
);
|
|
|
|
|
2024-09-26 20:45:48 +08:00
|
|
|
-- 创建发布数据名称索引
|
2024-10-31 15:12:26 +08:00
|
|
|
CREATE INDEX ON rtsa.release_data (name);
|
2024-09-26 20:45:48 +08:00
|
|
|
|
|
|
|
-- 创建发布数据用户索引
|
2024-10-31 15:12:26 +08:00
|
|
|
CREATE INDEX ON rtsa.release_data (user_id);
|
2024-09-26 20:45:48 +08:00
|
|
|
|
|
|
|
-- 创建发布数据类型索引
|
2024-10-31 15:12:26 +08:00
|
|
|
CREATE INDEX ON rtsa.release_data (data_type);
|
2024-09-26 20:45:48 +08:00
|
|
|
|
|
|
|
-- 创建发布数据配置项索引
|
2024-10-31 15:12:26 +08:00
|
|
|
CREATE INDEX ON rtsa.release_data USING GIN (options);
|
2024-09-26 20:45:48 +08:00
|
|
|
|
2024-09-14 16:45:33 +08:00
|
|
|
-- 注释发布数据表
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON TABLE rtsa.release_data IS '发布数据表';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
|
|
|
-- 注释发布数据表字段
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.release_data.id IS 'id 自增主键';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.release_data.name IS '发布数据名称(数据唯一标识)';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.release_data.data_type IS '数据类型';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.release_data.options IS '数据相关的参数项或配置项';
|
2024-09-19 00:07:53 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.release_data.used_version_id IS '使用的版本数据id';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.release_data.user_id IS '发布/更新用户id';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.release_data.is_published IS '是否上架';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.release_data.created_at IS '创建时间';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.release_data.updated_at IS '更新时间';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
|
|
|
-- 创建发布数据版本表
|
|
|
|
CREATE TABLE
|
2024-10-31 15:12:26 +08:00
|
|
|
rtsa.release_data_version (
|
2024-09-14 16:45:33 +08:00
|
|
|
id SERIAL PRIMARY KEY, -- id 自增主键
|
|
|
|
release_data_id INT NOT NULL, -- 发布数据id
|
2024-09-20 12:31:18 +08:00
|
|
|
options JSONB NULL, -- 数据相关的参数项或配置项
|
2024-09-14 16:45:33 +08:00
|
|
|
data BYTEA NOT NULL, -- 数据
|
|
|
|
description TEXT NOT NULL, -- 版本描述
|
|
|
|
user_id INT NOT NULL, -- 发布用户id
|
2024-09-19 11:03:05 +08:00
|
|
|
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间
|
2024-10-31 15:12:26 +08:00
|
|
|
FOREIGN KEY (user_id) REFERENCES rtsa.user (id) ON DELETE CASCADE, -- 用户外键
|
|
|
|
FOREIGN KEY (release_data_id) REFERENCES rtsa.release_data (id) ON DELETE CASCADE
|
2024-09-14 16:45:33 +08:00
|
|
|
);
|
|
|
|
|
2024-09-26 20:45:48 +08:00
|
|
|
-- 创建发布数据版本发布数据索引
|
2024-10-31 15:12:26 +08:00
|
|
|
CREATE INDEX ON rtsa.release_data_version (release_data_id);
|
2024-09-26 20:45:48 +08:00
|
|
|
|
|
|
|
-- 创建发布数据版本用户索引
|
2024-10-31 15:12:26 +08:00
|
|
|
CREATE INDEX ON rtsa.release_data_version (user_id);
|
2024-09-26 20:45:48 +08:00
|
|
|
|
|
|
|
-- 创建发布数据版本配置项索引
|
2024-10-31 15:12:26 +08:00
|
|
|
CREATE INDEX ON rtsa.release_data_version USING GIN (options);
|
2024-09-26 20:45:48 +08:00
|
|
|
|
2024-09-14 16:45:33 +08:00
|
|
|
-- 创建发布数据当前版本外键
|
2024-10-31 15:12:26 +08:00
|
|
|
ALTER TABLE rtsa.release_data ADD FOREIGN KEY (used_version_id) REFERENCES rtsa.release_data_version (id) ON DELETE SET NULL;
|
2024-09-14 16:45:33 +08:00
|
|
|
|
|
|
|
-- 创建草稿数据默认发布数据外键
|
2024-10-31 15:12:26 +08:00
|
|
|
ALTER TABLE rtsa.draft_data ADD FOREIGN KEY (default_release_data_id) REFERENCES rtsa.release_data (id) ON DELETE SET NULL;
|
2024-09-14 16:45:33 +08:00
|
|
|
|
|
|
|
-- 注释发布数据版本表
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON TABLE rtsa.release_data_version IS '发布数据版本表';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
|
|
|
-- 注释发布数据版本表字段
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.release_data_version.id IS 'id 自增主键';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.release_data_version.release_data_id IS '发布数据id';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.release_data_version.options IS '数据相关的参数项或配置项';
|
2024-09-20 12:31:18 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.release_data_version.data IS '数据';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.release_data_version.description IS '版本描述';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.release_data_version.user_id IS '发布用户id';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.release_data_version.created_at IS '创建时间';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
|
|
|
-- 创建feature表
|
|
|
|
CREATE TABLE
|
2024-10-31 15:12:26 +08:00
|
|
|
rtsa.feature (
|
2024-09-14 16:45:33 +08:00
|
|
|
id SERIAL PRIMARY KEY, -- id 自增主键
|
|
|
|
feature_type INT NOT NULL, -- feature类型
|
|
|
|
name VARCHAR(128) NOT NULL UNIQUE, -- feature名称
|
|
|
|
description TEXT NOT NULL, -- feature描述
|
2024-09-26 20:45:48 +08:00
|
|
|
config JSONB NOT NULL, -- feature配置
|
2024-09-14 16:45:33 +08:00
|
|
|
is_published BOOLEAN NOT NULL DEFAULT TRUE, -- 是否上架
|
|
|
|
creator_id INT NOT NULL, -- 创建用户id
|
|
|
|
updater_id INT NOT NULL, -- 更新用户id
|
2024-09-19 11:03:05 +08:00
|
|
|
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间
|
2024-09-25 18:35:45 +08:00
|
|
|
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 更新时间
|
2024-10-31 15:12:26 +08:00
|
|
|
FOREIGN KEY (creator_id) REFERENCES rtsa.user (id) ON DELETE CASCADE, -- 用户外键
|
|
|
|
FOREIGN KEY (updater_id) REFERENCES rtsa.user (id) ON DELETE CASCADE -- 用户外键
|
2024-09-14 16:45:33 +08:00
|
|
|
);
|
|
|
|
|
2024-09-26 20:45:48 +08:00
|
|
|
-- 创建feature类型索引
|
2024-10-31 15:12:26 +08:00
|
|
|
CREATE INDEX ON rtsa.feature (feature_type);
|
2024-09-26 20:45:48 +08:00
|
|
|
|
|
|
|
-- 创建feature名称索引
|
2024-10-31 15:12:26 +08:00
|
|
|
CREATE INDEX ON rtsa.feature (name);
|
2024-09-26 20:45:48 +08:00
|
|
|
|
2024-09-14 16:45:33 +08:00
|
|
|
-- 注释仿真feature表
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON TABLE rtsa.feature IS 'feature表';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
|
|
|
-- 注释仿真feature表字段
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.feature.id IS 'id 自增主键';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.feature.feature_type IS 'feature类型';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.feature.name IS 'feature名称';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.feature.description IS 'feature描述';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.feature.config IS 'feature配置';
|
2024-09-26 20:45:48 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.feature.is_published IS '是否上架';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.feature.creator_id IS '创建用户id';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.feature.created_at IS '创建时间';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.feature.updated_at IS '更新时间';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-09-26 20:45:48 +08:00
|
|
|
-- 创建用户配置表
|
2024-09-14 16:45:33 +08:00
|
|
|
CREATE TABLE
|
2024-10-31 15:12:26 +08:00
|
|
|
rtsa.user_config (
|
2024-09-14 16:45:33 +08:00
|
|
|
id SERIAL PRIMARY KEY, -- id 自增主键
|
|
|
|
user_id INT NOT NULL, -- 用户id
|
2024-09-26 20:45:48 +08:00
|
|
|
config_type INT NOT NULL, -- 配置类型
|
2024-09-14 16:45:33 +08:00
|
|
|
config BYTEA NOT NULL, -- 配置
|
2024-09-19 11:03:05 +08:00
|
|
|
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间
|
|
|
|
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 更新时间
|
2024-10-31 15:12:26 +08:00
|
|
|
FOREIGN KEY (user_id) REFERENCES rtsa.user (id) ON DELETE CASCADE -- 用户外键
|
2024-09-14 16:45:33 +08:00
|
|
|
);
|
|
|
|
|
2024-09-26 20:45:48 +08:00
|
|
|
-- 创建用户配置用户索引
|
2024-10-31 15:12:26 +08:00
|
|
|
CREATE INDEX ON rtsa.user_config (user_id);
|
2024-09-26 20:45:48 +08:00
|
|
|
|
|
|
|
-- 创建用户配置类型索引
|
2024-10-31 15:12:26 +08:00
|
|
|
CREATE INDEX ON rtsa.user_config (config_type);
|
2024-09-26 20:45:48 +08:00
|
|
|
|
2024-09-14 16:45:33 +08:00
|
|
|
-- 注释用户feature配置表
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON TABLE rtsa.user_config IS '用户feature配置表';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
|
|
|
-- 注释用户feature配置表字段
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.user_config.id IS 'id 自增主键';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.user_config.user_id IS '用户id';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.user_config.config_type IS '配置类型';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.user_config.config IS '配置';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.user_config.created_at IS '创建时间';
|
2024-09-14 16:45:33 +08:00
|
|
|
|
2024-10-31 15:12:26 +08:00
|
|
|
COMMENT ON COLUMN rtsa.user_config.updated_at IS '更新时间';
|