优化sql脚本执行顺序
This commit is contained in:
180
doc/sql/createtable/user_performance_postgres.sql
Normal file
180
doc/sql/createtable/user_performance_postgres.sql
Normal file
@@ -0,0 +1,180 @@
|
||||
create table user_performance
|
||||
(
|
||||
id bigint not null primary key,
|
||||
user_id bigint,
|
||||
user_phone bigint,
|
||||
user_name varchar(128),
|
||||
performance decimal(16, 4) default 0,
|
||||
own_performance decimal(16, 4) default 0,
|
||||
version int default 1,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status integer default 1,
|
||||
is_deleted integer default 0
|
||||
);
|
||||
create index up_index
|
||||
on user_performance (is_deleted, user_id);
|
||||
COMMENT ON TABLE user_performance IS '用户现金业绩表';
|
||||
COMMENT ON COLUMN user_performance.id IS '主键';
|
||||
COMMENT ON COLUMN user_performance.user_id IS '用户ID';
|
||||
COMMENT ON COLUMN user_performance.user_phone IS '用户手机号';
|
||||
COMMENT ON COLUMN user_performance.user_name IS '用户名称';
|
||||
COMMENT ON COLUMN user_performance.performance IS '总业绩';
|
||||
COMMENT ON COLUMN user_performance.own_performance IS '自身业绩';
|
||||
COMMENT ON COLUMN user_performance.version IS '版本号';
|
||||
comment on column user_performance.create_user is '创建人';
|
||||
comment on column user_performance.create_dept is '创建部门';
|
||||
comment on column user_performance.create_time is '创建时间';
|
||||
comment on column user_performance.update_user is '修改人';
|
||||
comment on column user_performance.update_time is '修改时间';
|
||||
comment on column user_performance.status is '状态';
|
||||
comment on column user_performance.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_performance
|
||||
owner to postgres;
|
||||
|
||||
create table user_performance_log
|
||||
(
|
||||
id bigint not null primary key,
|
||||
user_id bigint,
|
||||
user_phone bigint,
|
||||
user_name varchar(128),
|
||||
amount decimal(14, 4) default 0,
|
||||
source_id bigint,
|
||||
source_detail text,
|
||||
order_id bigint,
|
||||
type int default 1,
|
||||
statistical_date timestamp(6),
|
||||
channel varchar(64),
|
||||
channel_detail text,
|
||||
remark text,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status integer default 1,
|
||||
is_deleted integer default 0
|
||||
);
|
||||
|
||||
create index user_performance_log_index
|
||||
on user_performance_log (is_deleted, user_id, statistical_date , type);
|
||||
|
||||
comment on table user_performance_log is '用户现金业绩日志表';
|
||||
comment on column user_performance_log.id is '主键';
|
||||
comment on column user_performance_log.user_id is '用户ID';
|
||||
comment on column user_performance_log.user_phone is '用户手机号';
|
||||
comment on column user_performance_log.user_name is '用户名称';
|
||||
comment on column user_performance_log.amount is '业绩变动金额';
|
||||
comment on column user_performance_log.source_id is '来源ID';
|
||||
comment on column user_performance_log.source_detail is '来源详情';
|
||||
comment on column user_performance_log.order_id is '订单ID';
|
||||
comment on column user_performance_log.type is '类型 1增加 2减少';
|
||||
comment on column user_performance_log.statistical_date is '统计日期';
|
||||
comment on column user_performance_log.channel is '渠道';
|
||||
comment on column user_performance_log.channel_detail is '渠道详情';
|
||||
comment on column user_performance_log.remark is '备注';
|
||||
comment on column user_performance_log.create_user is '创建人';
|
||||
comment on column user_performance_log.create_dept is '创建部门';
|
||||
comment on column user_performance_log.create_time is '创建时间';
|
||||
comment on column user_performance_log.update_user is '修改人';
|
||||
comment on column user_performance_log.update_time is '修改时间';
|
||||
comment on column user_performance_log.status is '状态';
|
||||
comment on column user_performance_log.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_performance_log
|
||||
owner to postgres;
|
||||
|
||||
|
||||
create table user_performance_benefit
|
||||
(
|
||||
id bigint not null primary key,
|
||||
user_id bigint,
|
||||
user_phone bigint,
|
||||
user_name varchar(128),
|
||||
performance decimal(16, 4) default 0,
|
||||
own_performance decimal(16, 4) default 0,
|
||||
version int default 1,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status integer default 1,
|
||||
is_deleted integer default 0
|
||||
);
|
||||
create index upb_index
|
||||
on user_performance_benefit (is_deleted, user_id);
|
||||
COMMENT ON TABLE user_performance_benefit IS '用户福利值业绩表';
|
||||
COMMENT ON COLUMN user_performance_benefit.id IS '主键';
|
||||
COMMENT ON COLUMN user_performance_benefit.user_id IS '用户ID';
|
||||
COMMENT ON COLUMN user_performance_benefit.user_phone IS '用户手机号';
|
||||
COMMENT ON COLUMN user_performance_benefit.user_name IS '用户名称';
|
||||
COMMENT ON COLUMN user_performance_benefit.performance IS '总业绩';
|
||||
COMMENT ON COLUMN user_performance_benefit.own_performance IS '自身业绩';
|
||||
COMMENT ON COLUMN user_performance_benefit.version IS '版本号';
|
||||
comment on column user_performance_benefit.create_user is '创建人';
|
||||
comment on column user_performance_benefit.create_dept is '创建部门';
|
||||
comment on column user_performance_benefit.create_time is '创建时间';
|
||||
comment on column user_performance_benefit.update_user is '修改人';
|
||||
comment on column user_performance_benefit.update_time is '修改时间';
|
||||
comment on column user_performance_benefit.status is '状态';
|
||||
comment on column user_performance_benefit.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_performance_benefit
|
||||
owner to postgres;
|
||||
|
||||
create table user_performance_benefit_log
|
||||
(
|
||||
id bigint not null primary key,
|
||||
user_id bigint,
|
||||
user_phone bigint,
|
||||
user_name varchar(128),
|
||||
amount decimal(14, 4) default 0,
|
||||
source_id bigint,
|
||||
source_detail text,
|
||||
order_id bigint,
|
||||
type int default 1,
|
||||
statistical_date timestamp(6),
|
||||
channel varchar(64),
|
||||
channel_detail text,
|
||||
remark text,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status integer default 1,
|
||||
is_deleted integer default 0
|
||||
);
|
||||
|
||||
create index upbl_index
|
||||
on user_performance_benefit_log (is_deleted, user_id, statistical_date , type);
|
||||
|
||||
comment on table user_performance_benefit_log is '用户福利值业绩日志表';
|
||||
comment on column user_performance_benefit_log.id is '主键';
|
||||
comment on column user_performance_benefit_log.user_id is '用户ID';
|
||||
comment on column user_performance_benefit_log.user_phone is '用户手机号';
|
||||
comment on column user_performance_benefit_log.user_name is '用户名称';
|
||||
comment on column user_performance_benefit_log.amount is '业绩变动金额';
|
||||
comment on column user_performance_benefit_log.source_id is '来源ID';
|
||||
comment on column user_performance_benefit_log.source_detail is '来源详情';
|
||||
comment on column user_performance_benefit_log.order_id is '订单ID';
|
||||
comment on column user_performance_benefit_log.type is '类型 1增加 2减少';
|
||||
comment on column user_performance_benefit_log.statistical_date is '统计日期';
|
||||
comment on column user_performance_benefit_log.channel is '渠道';
|
||||
comment on column user_performance_benefit_log.channel_detail is '渠道详情';
|
||||
comment on column user_performance_benefit_log.remark is '备注';
|
||||
comment on column user_performance_benefit_log.create_user is '创建人';
|
||||
comment on column user_performance_benefit_log.create_dept is '创建部门';
|
||||
comment on column user_performance_benefit_log.create_time is '创建时间';
|
||||
comment on column user_performance_benefit_log.update_user is '修改人';
|
||||
comment on column user_performance_benefit_log.update_time is '修改时间';
|
||||
comment on column user_performance_benefit_log.status is '状态';
|
||||
comment on column user_performance_benefit_log.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_performance_benefit_log
|
||||
owner to postgres;
|
||||
Reference in New Issue
Block a user