feat:
1. prod
This commit is contained in:
@@ -1,179 +1,123 @@
|
|||||||
create table user_genealogy
|
create table user_market_genealogy
|
||||||
(
|
(
|
||||||
id int8 not null primary key,
|
id int8 not null primary key, -- user_id
|
||||||
name varchar(128),
|
level int4 default 1, --当前层数
|
||||||
phone int8,
|
|
||||||
level integer default 1, --当前层数
|
|
||||||
pid int8,
|
pid int8,
|
||||||
p_name varchar(128),
|
root_id int8, --遍历当前树
|
||||||
p_phone int8,
|
group_id int8, --树内最近团队长的id
|
||||||
root_id int8, --遍历当前树
|
genealogy_list int8[], -- 往上所有父级
|
||||||
group_id int8, --树内最近团队长的id
|
user_child_number int, --用户下线总人数
|
||||||
genealogy_list int8[], -- 往上所有父级
|
user_direct_number int, --用户直推总人数
|
||||||
user_child_number int, --用户下线总人数
|
user_direct_list int8[], --直推列表
|
||||||
user_direct_number int, --用户直推总人数
|
|
||||||
user_direct_list int8[], --直推列表
|
|
||||||
is_revoked int4 default 0, --是否注销 0-否 1-是
|
|
||||||
register_date timestamp(6), -- 注册时间
|
|
||||||
remark text,
|
remark text,
|
||||||
create_user int8,
|
create_user int8,
|
||||||
create_dept int8,
|
create_dept int8,
|
||||||
create_time timestamp(6),
|
create_time timestamp(6),
|
||||||
update_user int8,
|
update_user int8,
|
||||||
update_time timestamp(6),
|
update_time timestamp(6),
|
||||||
status int4 default 1,
|
status int4 default 1, -- 1: active -- 2: revoked (注销) -- 3: frozen (冻结)
|
||||||
is_deleted int4 default 0
|
is_deleted int4 default 0
|
||||||
);
|
);
|
||||||
|
CREATE INDEX idx_ug_pid ON user_market_genealogy (pid) WHERE status = 1;
|
||||||
|
CREATE INDEX idx_ug_root ON user_market_genealogy (root_id) WHERE status = 1;
|
||||||
|
CREATE INDEX idx_ug_root_level ON user_market_genealogy (root_id, level) WHERE status = 1;
|
||||||
|
CREATE INDEX idx_ug_path ON user_market_genealogy USING gin (genealogy_list);
|
||||||
|
CREATE INDEX idx_ug_direct ON user_market_genealogy USING gin (user_direct_list);
|
||||||
|
|
||||||
CREATE INDEX user_genealogy_list_gin_idx
|
comment on table user_market_genealogy is '用户族谱表';
|
||||||
ON user_genealogy USING gin (genealogy_list);
|
comment on column user_market_genealogy.id is '主键';
|
||||||
CREATE INDEX user_direct_list_gin_idx
|
comment on column user_market_genealogy.pid is '上级id';
|
||||||
ON user_genealogy USING gin (user_direct_list);
|
comment on column user_market_genealogy.level is '层级';
|
||||||
|
comment on column user_market_genealogy.root_id is '根节点id';
|
||||||
create index user_genealogy_phone_index
|
comment on column user_market_genealogy.group_id is '团队长id';
|
||||||
on user_genealogy (is_deleted, phone , is_revoked);
|
comment on column user_market_genealogy.genealogy_list is '族谱列表';
|
||||||
|
comment on column user_market_genealogy.user_child_number is '用户下线总人数';
|
||||||
create index user_genealogy_register_date_index
|
comment on column user_market_genealogy.user_direct_number is '用户直推总人数';
|
||||||
on user_genealogy (is_deleted, register_date);
|
comment on column user_market_genealogy.user_direct_list is '直推列表';
|
||||||
|
comment on column user_market_genealogy.create_user is '创建人';
|
||||||
comment on table user_genealogy is '用户族谱表';
|
comment on column user_market_genealogy.create_dept is '创建部门';
|
||||||
comment on column user_genealogy.id is '主键';
|
comment on column user_market_genealogy.create_time is '创建时间';
|
||||||
comment on column user_genealogy.pid is '上级id';
|
comment on column user_market_genealogy.update_user is '修改人';
|
||||||
comment on column user_genealogy.name is '用户名';
|
comment on column user_market_genealogy.update_time is '修改时间';
|
||||||
comment on column user_genealogy.phone is '手机号';
|
comment on column user_market_genealogy.status is '状态 -- 1: active -- 2: revoked (注销) -- 3: frozen (冻结)';
|
||||||
comment on column user_genealogy.p_name is '上级用户名';
|
comment on column user_market_genealogy.is_deleted is '是否已删除';
|
||||||
comment on column user_genealogy.p_phone is '上级用户手机号';
|
alter table user_market_genealogy
|
||||||
comment on column user_genealogy.level is '层级';
|
|
||||||
comment on column user_genealogy.root_id is '根节点id';
|
|
||||||
comment on column user_genealogy.group_id is '团队长id';
|
|
||||||
comment on column user_genealogy.genealogy_list is '族谱列表';
|
|
||||||
comment on column user_genealogy.user_child_number is '用户下线总人数';
|
|
||||||
comment on column user_genealogy.user_direct_number is '用户直推总人数';
|
|
||||||
comment on column user_genealogy.user_direct_list is '直推列表';
|
|
||||||
comment on column user_genealogy.is_revoked is '是否注销 0-否 1-是';
|
|
||||||
comment on column user_genealogy.register_date is '注册时间';
|
|
||||||
comment on column user_genealogy.create_user is '创建人';
|
|
||||||
comment on column user_genealogy.create_dept is '创建部门';
|
|
||||||
comment on column user_genealogy.create_time is '创建时间';
|
|
||||||
comment on column user_genealogy.update_user is '修改人';
|
|
||||||
comment on column user_genealogy.update_time is '修改时间';
|
|
||||||
comment on column user_genealogy.status is '状态';
|
|
||||||
comment on column user_genealogy.is_deleted is '是否已删除';
|
|
||||||
alter table user_genealogy
|
|
||||||
owner to yicha1lu;
|
owner to yicha1lu;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
create table user_tree
|
create table user_market_tree
|
||||||
(
|
(
|
||||||
id int8 not null primary key,
|
id int8 not null primary key, --user_id
|
||||||
name varchar(128),
|
|
||||||
phone int8,
|
|
||||||
level int4 default 1,
|
level int4 default 1,
|
||||||
pid int8,
|
pid int8,
|
||||||
p_name varchar(128),
|
is_sync_genealogy int4 default 0, --是否同步族谱 0-否 1-是
|
||||||
p_phone int8,
|
|
||||||
p_level int4 default 1,
|
|
||||||
is_revoked int4 default 0, --是否注销 0-否 1-是
|
|
||||||
is_sync_genealogy int4 default 0, --是否同步族谱 0-否 1-是
|
|
||||||
register_date timestamp(6), -- 注册时间
|
|
||||||
create_user int8,
|
create_user int8,
|
||||||
create_dept int8,
|
create_dept int8,
|
||||||
create_time timestamp(6),
|
create_time timestamp(6),
|
||||||
update_user int8,
|
update_user int8,
|
||||||
update_time timestamp(6),
|
update_time timestamp(6),
|
||||||
status int4 default 1,
|
status int4 default 1, -- 1: active -- 2: revoked (注销) -- 3: frozen (冻结)
|
||||||
is_deleted int4 default 0
|
is_deleted int4 default 0
|
||||||
);
|
);
|
||||||
|
CREATE INDEX idx_user_tree_pid ON user_market_tree (pid) WHERE status = 1;
|
||||||
|
create index idx_user_tree_sync_genealogy on user_market_tree (is_deleted, is_sync_genealogy) WHERE status = 1;
|
||||||
|
CREATE INDEX idx_user_tree_level ON user_market_tree (level) WHERE status = 1;
|
||||||
|
|
||||||
|
comment on table user_market_tree is '用户树结构表';
|
||||||
create index user_tree_phone_index
|
comment on column user_market_tree.id is '主键';
|
||||||
on user_tree (is_deleted, phone);
|
comment on column user_market_tree.pid is '上级id';
|
||||||
|
comment on column user_market_tree.level is '层级';
|
||||||
create index user_tree_sync_genealogy_index
|
comment on column user_market_tree.is_sync_genealogy is '是否同步族谱 0-否 1-是';
|
||||||
on user_tree (is_deleted, is_sync_genealogy);
|
comment on column user_market_tree.create_user is '创建人';
|
||||||
|
comment on column user_market_tree.create_dept is '创建部门';
|
||||||
create index user_tree_register_date_index
|
comment on column user_market_tree.create_time is '创建时间';
|
||||||
on user_tree (is_deleted, register_date);
|
comment on column user_market_tree.update_user is '修改人';
|
||||||
|
comment on column user_market_tree.update_time is '修改时间';
|
||||||
|
comment on column user_market_tree.status is '状态';
|
||||||
comment on table user_tree is '用户树结构表';
|
comment on column user_market_tree.is_deleted is '是否已删除';
|
||||||
comment on column user_tree.id is '主键';
|
alter table user_market_tree
|
||||||
comment on column user_tree.pid is '上级id';
|
|
||||||
comment on column user_tree.name is '用户名';
|
|
||||||
comment on column user_tree.phone is '手机号';
|
|
||||||
comment on column user_tree.level is '层级';
|
|
||||||
comment on column user_tree.p_name is '上级用户名';
|
|
||||||
comment on column user_tree.p_phone is '上级用户手机号';
|
|
||||||
comment on column user_tree.p_level is '上级用户层级';
|
|
||||||
comment on column user_tree.is_revoked is '是否注销 0-否 1-是';
|
|
||||||
comment on column user_tree.is_sync_genealogy is '是否同步族谱 0-否 1-是';
|
|
||||||
comment on column user_tree.register_date is '注册时间';
|
|
||||||
comment on column user_tree.create_user is '创建人';
|
|
||||||
comment on column user_tree.create_dept is '创建部门';
|
|
||||||
comment on column user_tree.create_time is '创建时间';
|
|
||||||
comment on column user_tree.update_user is '修改人';
|
|
||||||
comment on column user_tree.update_time is '修改时间';
|
|
||||||
comment on column user_tree.status is '状态';
|
|
||||||
comment on column user_tree.is_deleted is '是否已删除';
|
|
||||||
alter table user_tree
|
|
||||||
owner to yicha1lu;
|
owner to yicha1lu;
|
||||||
|
|
||||||
create table user_increase_day
|
|
||||||
|
|
||||||
|
create table user_market_info
|
||||||
(
|
(
|
||||||
id int8 not null primary key,
|
id int8 not null primary key, --user_id
|
||||||
name varchar(128),
|
current_vip_id int4, --用户当前等级
|
||||||
phone int8,
|
current_vip_name varchar(12), --用户当前等级
|
||||||
current_level_id int4, --用户当前等级
|
pid int8,
|
||||||
current_level_name varchar(12), --用户当前等级
|
p_vip int4 default 1,
|
||||||
pid int8,
|
is_verified int4 default 0, -- 是否实名用户 0-否 1-是
|
||||||
p_name varchar(128),
|
verified_date timestamp(6), -- 实名时间
|
||||||
p_phone int8,
|
real_name varchar(128), -- 实名姓名
|
||||||
p_level int4 default 1,
|
id_card varchar(128), -- 实名身份证
|
||||||
is_real int4 default 0, -- 是否实名用户 0-否 1-是
|
create_user int8,
|
||||||
real_date timestamp(6), -- 实名时间
|
create_dept int8,
|
||||||
real_name varchar(128), -- 实名姓名
|
create_time timestamp(6),
|
||||||
real_id_card varchar(128), -- 实名身份证
|
update_user int8,
|
||||||
is_revoked int4 default 0, --是否注销 0-否 1-是
|
update_time timestamp(6),
|
||||||
register_date timestamp(6), -- 注册时间
|
status int4 default 1, -- 1: active -- 2: revoked (注销) -- 3: frozen (冻结)
|
||||||
create_user int8,
|
is_deleted int4 default 0
|
||||||
create_dept int8,
|
|
||||||
create_time timestamp(6),
|
|
||||||
update_user int8,
|
|
||||||
update_time timestamp(6),
|
|
||||||
status int4 default 1,
|
|
||||||
is_deleted int4 default 0
|
|
||||||
);
|
);
|
||||||
create index user_increase_day_phone_index
|
|
||||||
on user_increase_day (is_deleted, phone);
|
|
||||||
|
|
||||||
create index uid_register_date_index
|
|
||||||
on user_increase_day (is_deleted, register_date);
|
|
||||||
|
|
||||||
comment on table user_increase_day is '用户增加天数表';
|
|
||||||
|
|
||||||
comment on column user_increase_day.id is '主键';
|
comment on table user_market_info is '用户增加天数表';
|
||||||
comment on column user_increase_day.current_level_id is '用户当前等级';
|
|
||||||
comment on column user_increase_day.current_level_name is '用户当前等级';
|
comment on column user_market_info.id is '主键';
|
||||||
comment on column user_increase_day.name is '用户名';
|
comment on column user_market_info.is_verified is '是否实名用户 0-否 1-是';
|
||||||
comment on column user_increase_day.p_name is '上级用户名';
|
comment on column user_market_info.verified_date is '实名时间';
|
||||||
comment on column user_increase_day.p_phone is '上级用户手机号';
|
comment on column user_market_info.real_name is '实名姓名';
|
||||||
comment on column user_increase_day.p_level is '上级用户层级';
|
comment on column user_market_info.id_card is '实名身份证';
|
||||||
comment on column user_increase_day.is_real is '是否实名用户 0-否 1-是';
|
comment on column user_market_info.create_user is '创建人';
|
||||||
comment on column user_increase_day.real_date is '实名时间';
|
comment on column user_market_info.create_dept is '创建部门';
|
||||||
comment on column user_increase_day.real_name is '实名姓名';
|
comment on column user_market_info.create_time is '创建时间';
|
||||||
comment on column user_increase_day.real_id_card is '实名身份证';
|
comment on column user_market_info.update_user is '修改人';
|
||||||
comment on column user_increase_day.register_date is '注册时间';
|
comment on column user_market_info.update_time is '修改时间';
|
||||||
comment on column user_increase_day.is_revoked is '是否注销 0-否 1-是';
|
comment on column user_market_info.status is '状态';
|
||||||
comment on column user_increase_day.register_date is '注册时间';
|
comment on column user_market_info.is_deleted is '是否已删除';
|
||||||
comment on column user_increase_day.create_user is '创建人';
|
alter table user_market_info
|
||||||
comment on column user_increase_day.create_dept is '创建部门';
|
|
||||||
comment on column user_increase_day.create_time is '创建时间';
|
|
||||||
comment on column user_increase_day.update_user is '修改人';
|
|
||||||
comment on column user_increase_day.update_time is '修改时间';
|
|
||||||
comment on column user_increase_day.status is '状态';
|
|
||||||
comment on column user_increase_day.is_deleted is '是否已删除';
|
|
||||||
alter table user_increase_day
|
|
||||||
owner to yicha1lu;
|
owner to yicha1lu;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user