|
|
-- public.article definition
|
|
|
-- Drop table
|
|
|
-- DROP TABLE public.article;
|
|
|
CREATE TABLE public.article(
|
|
|
id bigserial NOT NULL, -- ID
|
|
|
company_id int8 NULL, -- 公司ID
|
|
|
created_at int8 NULL, -- 创建时间
|
|
|
updated_at int8 NULL, -- 更新时间
|
|
|
deleted_at int8 NULL, -- 删除时间
|
|
|
is_del int8 NULL, -- 是否删除
|
|
|
"version" int8 NULL DEFAULT 0, -- 版本
|
|
|
author_id int8 NULL DEFAULT 0, -- 发布人
|
|
|
author jsonb NULL DEFAULT '{}' ::jsonb, -- 发布人对象
|
|
|
title text NULL, -- 文章标题
|
|
|
images jsonb NULL DEFAULT '[]' ::jsonb, -- 图片
|
|
|
who_read jsonb NULL DEFAULT '[]' ::jsonb, -- 谁可以看
|
|
|
who_review jsonb NULL DEFAULT '[]' ::jsonb, -- 评论人
|
|
|
"location" jsonb NULL DEFAULT '{}' ::jsonb, -- 坐标
|
|
|
target_user int8 NULL DEFAULT 0, -- 分发方式 0 分发给所有人 1 分发给指定的人
|
|
|
count_love int8 NULL DEFAULT 0, -- 点赞数量
|
|
|
count_comment int8 NULL DEFAULT 0, -- 评论数量
|
|
|
"show" int8 NULL DEFAULT 1, -- 评论的展示状态(1显示、2不显示)
|
|
|
tags jsonb NULL DEFAULT '[]' ::jsonb, -- 标签
|
|
|
count_read int8 NULL DEFAULT 0, -- 已读数量
|
|
|
summary text NULL,
|
|
|
match_url jsonb NULL DEFAULT '{}' ::jsonb,
|
|
|
videos jsonb NULL DEFAULT '[]' ::jsonb,
|
|
|
CONSTRAINT article_pkey PRIMARY KEY (id)
|
|
|
);
|
|
|
|
|
|
CREATE INDEX article_company_id_idx ON public.article USING btree(company_id);
|
|
|
|
|
|
-- Column comments
|
|
|
COMMENT ON COLUMN public.article.id IS 'ID';
|
|
|
|
|
|
COMMENT ON COLUMN public.article.company_id IS '公司ID';
|
|
|
|
|
|
COMMENT ON COLUMN public.article.created_at IS '创建时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.article.updated_at IS '更新时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.article.deleted_at IS '删除时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.article.is_del IS '是否删除';
|
|
|
|
|
|
COMMENT ON COLUMN public.article. "version" IS '版本';
|
|
|
|
|
|
COMMENT ON COLUMN public.article.author_id IS '发布人';
|
|
|
|
|
|
COMMENT ON COLUMN public.article.author IS '发布人对象';
|
|
|
|
|
|
COMMENT ON COLUMN public.article.title IS '文章标题';
|
|
|
|
|
|
COMMENT ON COLUMN public.article.images IS '图片';
|
|
|
|
|
|
COMMENT ON COLUMN public.article.who_read IS '谁可以看';
|
|
|
|
|
|
COMMENT ON COLUMN public.article.who_review IS '评论人';
|
|
|
|
|
|
COMMENT ON COLUMN public.article. "location" IS '坐标';
|
|
|
|
|
|
COMMENT ON COLUMN public.article.target_user IS '分发方式 0 分发给所有人 1 分发给指定的人';
|
|
|
|
|
|
COMMENT ON COLUMN public.article.count_love IS '点赞数量';
|
|
|
|
|
|
COMMENT ON COLUMN public.article.count_comment IS '评论数量';
|
|
|
|
|
|
COMMENT ON COLUMN public.article. "show" IS '评论的展示状态(1显示、2不显示)';
|
|
|
|
|
|
COMMENT ON COLUMN public.article.tags IS '标签';
|
|
|
|
|
|
COMMENT ON COLUMN public.article.count_read IS '已读数量';
|
|
|
|
|
|
-- public.article_and_tag definition
|
|
|
-- Drop table
|
|
|
-- DROP TABLE public.article_and_tag;
|
|
|
CREATE TABLE public.article_and_tag(
|
|
|
id bigserial NOT NULL,
|
|
|
company_id int8 NULL,
|
|
|
created_at int8 NULL,
|
|
|
updated_at int8 NULL,
|
|
|
article_id int8 NULL,
|
|
|
tag_id int8 NULL,
|
|
|
CONSTRAINT article_and_tag_pkey PRIMARY KEY (id)
|
|
|
);
|
|
|
|
|
|
CREATE INDEX article_and_tag_company_id_idx ON public.article_and_tag USING btree(company_id);
|
|
|
|
|
|
-- public.article_backup definition
|
|
|
-- Drop table
|
|
|
-- DROP TABLE public.article_backup;
|
|
|
CREATE TABLE public.article_backup(
|
|
|
id bigserial NOT NULL, -- ID
|
|
|
company_id int8 NULL, -- 公司ID
|
|
|
created_at int8 NULL, -- 创建时间
|
|
|
updated_at int8 NULL, -- 更新时间
|
|
|
deleted_at int8 NULL, -- 删除时间
|
|
|
is_del int8 NULL, -- 是否删除
|
|
|
"version" int8 NULL, -- 版本
|
|
|
"operator" jsonb NULL, -- 操作人
|
|
|
title text NULL, -- 标题
|
|
|
"section" jsonb NULL, -- 分段内容
|
|
|
images jsonb NULL, -- 图片
|
|
|
"action" text NULL, -- 操作
|
|
|
who_read jsonb NULL, -- 谁可以看
|
|
|
who_review jsonb NULL, -- 评论人
|
|
|
tags jsonb NULL, -- 标签
|
|
|
target_user int8 NULL, -- 分发方式 0 分发给所有人 1 分发给指定的人
|
|
|
article_id int8 NULL,
|
|
|
"location" jsonb NULL,
|
|
|
match_url jsonb NULL DEFAULT '{}' ::jsonb,
|
|
|
videos jsonb NULL DEFAULT '[]' ::jsonb,
|
|
|
CONSTRAINT article_backup_pkey PRIMARY KEY (id)
|
|
|
);
|
|
|
|
|
|
CREATE INDEX article_backup_company_id_idx ON public.article_backup USING btree(company_id);
|
|
|
|
|
|
-- Column comments
|
|
|
COMMENT ON COLUMN public.article_backup.id IS 'ID';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_backup.company_id IS '公司ID';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_backup.created_at IS '创建时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_backup.updated_at IS '更新时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_backup.deleted_at IS '删除时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_backup.is_del IS '是否删除';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_backup. "version" IS '版本';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_backup. "operator" IS '操作人';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_backup.title IS '标题';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_backup. "section" IS '分段内容';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_backup.images IS '图片';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_backup. "action" IS '操作';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_backup.who_read IS '谁可以看';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_backup.who_review IS '评论人';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_backup.tags IS '标签';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_backup.target_user IS '分发方式 0 分发给所有人 1 分发给指定的人';
|
|
|
|
|
|
-- public.article_comment definition
|
|
|
-- Drop table
|
|
|
-- DROP TABLE public.article_comment;
|
|
|
CREATE TABLE public.article_comment(
|
|
|
id bigserial NOT NULL, -- ID
|
|
|
company_id int8 NULL, -- 公司ID
|
|
|
created_at int8 NULL, -- 创建时间
|
|
|
updated_at int8 NULL, -- 更新时间
|
|
|
is_del int8 NULL, -- 是否删除
|
|
|
deleted_at int8 NULL, -- 删除时间
|
|
|
"version" int8 NULL, -- 版本
|
|
|
pid int8 NULL DEFAULT 0, -- 对哪个评论进行回复
|
|
|
top_id int8 NULL DEFAULT 0, -- 归属于最上级的哪个评论
|
|
|
article_id int8 NULL DEFAULT 0, -- 文章id
|
|
|
section_id int8 NULL DEFAULT 0, -- 文本段落内容id
|
|
|
section_content text NULL, -- 引用的文章内容文本
|
|
|
from_user_id int8 NULL DEFAULT 0, -- 谁填写的评论
|
|
|
from_user jsonb NULL DEFAULT '{}' ::jsonb, -- 谁填写的评论对象
|
|
|
to_user_id int8 NULL DEFAULT 0, -- 回复谁的评论
|
|
|
to_user jsonb NULL DEFAULT '{}' ::jsonb, -- 回复谁的评论对象
|
|
|
"content" text NULL, -- 评论内容
|
|
|
count_reply int8 NULL DEFAULT 0, -- 回复数量
|
|
|
count_user_love int8 NULL DEFAULT 0, -- 用户点赞数量
|
|
|
count_admin_love int8 NULL DEFAULT 0, -- 运营点赞数量
|
|
|
"show" int8 NULL DEFAULT 1, -- 评论的展示状态(1显示、2不显示)
|
|
|
at_who jsonb NULL DEFAULT '[]' ::jsonb, -- 填写评论时@的人
|
|
|
match_url jsonb NULL DEFAULT '{}' ::jsonb, -- 评论内容中出现的url.
|
|
|
CONSTRAINT article_comment_pkey PRIMARY KEY (id)
|
|
|
);
|
|
|
|
|
|
CREATE INDEX article_comment_company_id_idx ON public.article_comment USING btree(company_id);
|
|
|
|
|
|
-- Column comments
|
|
|
COMMENT ON COLUMN public.article_comment.id IS 'ID';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment.company_id IS '公司ID';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment.created_at IS '创建时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment.updated_at IS '更新时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment.is_del IS '是否删除';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment.deleted_at IS '删除时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment. "version" IS '版本';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment.pid IS '对哪个评论进行回复';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment.top_id IS '归属于最上级的哪个评论';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment.article_id IS '文章id';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment.section_id IS '文本段落内容id';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment.section_content IS '引用的文章内容文本';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment.from_user_id IS '谁填写的评论';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment.from_user IS '谁填写的评论对象';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment.to_user_id IS '回复谁的评论';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment.to_user IS '回复谁的评论对象';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment. "content" IS '评论内容';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment.count_reply IS '回复数量';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment.count_user_love IS '用户点赞数量';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment.count_admin_love IS '运营点赞数量';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment. "show" IS '评论的展示状态(1显示、2不显示)';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment.at_who IS '填写评论时@的人';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_comment.match_url IS '评论内容中出现的url.';
|
|
|
|
|
|
-- public.article_draft definition
|
|
|
-- Drop table
|
|
|
-- DROP TABLE public.article_draft;
|
|
|
CREATE TABLE public.article_draft(
|
|
|
id bigserial NOT NULL, -- ID
|
|
|
company_id int8 NULL, -- 公司ID
|
|
|
created_at int8 NULL, -- 创建时间
|
|
|
updated_at int8 NULL, -- 更新时间
|
|
|
is_del int8 NULL, -- 是否删除
|
|
|
deleted_at int8 NULL, -- 删除时间
|
|
|
"version" int8 NULL, -- 版本
|
|
|
"template" int8 NULL, -- 填写内容时用的样板0、无 1、演绎式 2、归纳式
|
|
|
"content" jsonb NULL, -- 文章内容
|
|
|
author_id int8 NULL, -- 发布人
|
|
|
title text NULL, -- 文章标题
|
|
|
images jsonb NULL, -- 图片
|
|
|
who_read jsonb NULL, -- 谁可以看
|
|
|
who_review jsonb NULL, -- 评论人
|
|
|
"location" jsonb NULL, -- 坐标
|
|
|
match_url jsonb NULL DEFAULT '{}' ::jsonb,
|
|
|
CONSTRAINT article_draft_pkey PRIMARY KEY (id)
|
|
|
);
|
|
|
|
|
|
CREATE INDEX article_draft_company_id_idx ON public.article_draft USING btree(company_id);
|
|
|
|
|
|
-- Column comments
|
|
|
COMMENT ON COLUMN public.article_draft.id IS 'ID';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_draft.company_id IS '公司ID';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_draft.created_at IS '创建时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_draft.updated_at IS '更新时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_draft.is_del IS '是否删除';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_draft.deleted_at IS '删除时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_draft. "version" IS '版本';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_draft. "template" IS '填写内容时用的样板0、无 1、演绎式 2、归纳式';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_draft. "content" IS '文章内容';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_draft.author_id IS '发布人';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_draft.title IS '文章标题';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_draft.images IS '图片';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_draft.who_read IS '谁可以看';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_draft.who_review IS '评论人';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_draft. "location" IS '坐标';
|
|
|
|
|
|
-- public.article_section definition
|
|
|
-- Drop table
|
|
|
-- DROP TABLE public.article_section;
|
|
|
CREATE TABLE public.article_section(
|
|
|
id bigserial NOT NULL, -- ID
|
|
|
company_id int8 NULL, -- 公司ID
|
|
|
created_at int8 NULL, -- 创建时间
|
|
|
updated_at int8 NULL, -- 更新时间
|
|
|
deleted_at int8 NULL, -- 删除时间
|
|
|
is_del int8 NULL, -- 是否删除
|
|
|
"version" int8 NULL, -- 版本
|
|
|
article_id int8 NULL, -- 文章id
|
|
|
"content" text NULL, -- 文本内容
|
|
|
sort_by int8 NULL, -- 排序
|
|
|
total_comment int8 NULL, -- 评论的数量
|
|
|
CONSTRAINT article_section_pkey PRIMARY KEY (id)
|
|
|
);
|
|
|
|
|
|
CREATE INDEX article_section_article_id_idx ON public.article_section USING btree(article_id);
|
|
|
|
|
|
CREATE INDEX article_section_company_id_idx ON public.article_section USING btree(company_id);
|
|
|
|
|
|
-- Column comments
|
|
|
COMMENT ON COLUMN public.article_section.id IS 'ID';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_section.company_id IS '公司ID';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_section.created_at IS '创建时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_section.updated_at IS '更新时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_section.deleted_at IS '删除时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_section.is_del IS '是否删除';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_section. "version" IS '版本';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_section.article_id IS '文章id';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_section. "content" IS '文本内容';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_section.sort_by IS '排序';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_section.total_comment IS '评论的数量';
|
|
|
|
|
|
-- public.article_tag definition
|
|
|
-- Drop table
|
|
|
-- DROP TABLE public.article_tag;
|
|
|
CREATE TABLE public.article_tag(
|
|
|
id bigserial NOT NULL, -- ID
|
|
|
company_id int8 NULL, -- 公司ID
|
|
|
created_at int8 NULL, -- 创建时间
|
|
|
updated_at int8 NULL, -- 更新时间
|
|
|
deleted_at int8 NULL, -- 删除时间
|
|
|
is_del int8 NULL DEFAULT 0, -- 是否删除
|
|
|
"version" int8 NULL, -- 版本
|
|
|
image jsonb NULL, -- 图片
|
|
|
"name" text NULL, -- 标签名称
|
|
|
category text NULL, -- 标签分类
|
|
|
remark text NULL, -- 备注
|
|
|
sort_by int8 NULL DEFAULT 0,
|
|
|
other text NULL,
|
|
|
CONSTRAINT article_tag_pkey PRIMARY KEY (id)
|
|
|
);
|
|
|
|
|
|
CREATE INDEX article_tag_company_id_idx ON public.article_tag USING btree(company_id);
|
|
|
|
|
|
-- Column comments
|
|
|
COMMENT ON COLUMN public.article_tag.id IS 'ID';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_tag.company_id IS '公司ID';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_tag.created_at IS '创建时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_tag.updated_at IS '更新时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_tag.deleted_at IS '删除时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_tag.is_del IS '是否删除';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_tag. "version" IS '版本';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_tag.image IS '图片';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_tag. "name" IS '标签名称';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_tag.category IS '标签分类';
|
|
|
|
|
|
COMMENT ON COLUMN public.article_tag.remark IS '备注';
|
|
|
|
|
|
-- public.company definition
|
|
|
-- Drop table
|
|
|
-- DROP TABLE public.company;
|
|
|
CREATE TABLE public.company(
|
|
|
id bigserial NOT NULL, -- ID
|
|
|
"name" text NULL, -- 名称
|
|
|
code text NULL, -- 编码(搜索使用,4位字母数字)
|
|
|
logo text NULL, -- 公司LOGO
|
|
|
created_at int8 NULL, -- 创建时间
|
|
|
updated_at int8 NULL, -- 更新时间
|
|
|
deleted_at int8 NULL, -- 删除时间
|
|
|
"version" int8 NULL, -- 版本
|
|
|
CONSTRAINT company_pkey PRIMARY KEY (id),
|
|
|
CONSTRAINT idx_company_code UNIQUE (code)
|
|
|
);
|
|
|
|
|
|
-- Column comments
|
|
|
COMMENT ON COLUMN public.company.id IS 'ID';
|
|
|
|
|
|
COMMENT ON COLUMN public.company. "name" IS '名称';
|
|
|
|
|
|
COMMENT ON COLUMN public.company.code IS '编码(搜索使用,4位字母数字)';
|
|
|
|
|
|
COMMENT ON COLUMN public.company.logo IS '公司LOGO';
|
|
|
|
|
|
COMMENT ON COLUMN public.company.created_at IS '创建时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.company.updated_at IS '更新时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.company.deleted_at IS '删除时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.company. "version" IS '版本';
|
|
|
|
|
|
-- public.department definition
|
|
|
-- Drop table
|
|
|
-- DROP TABLE public.department;
|
|
|
CREATE TABLE public.department(
|
|
|
id bigserial NOT NULL,
|
|
|
company_id int8 NULL,
|
|
|
parent_id int8 NULL,
|
|
|
"name" text NULL,
|
|
|
created_at int8 NULL,
|
|
|
updated_at int8 NULL,
|
|
|
deleted_at int8 NULL,
|
|
|
"version" int8 NULL,
|
|
|
is_del int8 NULL,
|
|
|
CONSTRAINT department_pkey PRIMARY KEY (id)
|
|
|
);
|
|
|
|
|
|
-- public.message_business definition
|
|
|
-- Drop table
|
|
|
-- DROP TABLE public.message_business;
|
|
|
CREATE TABLE public.message_business(
|
|
|
id bigserial NOT NULL,
|
|
|
"type" int8 NULL,
|
|
|
opt_type int8 NULL,
|
|
|
company_id int8 NULL,
|
|
|
user_id int8 NULL,
|
|
|
recipient_id int8 NULL,
|
|
|
article_id int8 NULL,
|
|
|
comment_id int8 NULL,
|
|
|
comment_parent_id int8 NULL,
|
|
|
created_at int8 NULL,
|
|
|
updated_at int8 NULL,
|
|
|
deleted_at int8 NULL,
|
|
|
"version" int8 NULL,
|
|
|
is_del int8 NULL,
|
|
|
CONSTRAINT message_business_pkey PRIMARY KEY (id)
|
|
|
);
|
|
|
|
|
|
-- public.message_system definition
|
|
|
-- Drop table
|
|
|
-- DROP TABLE public.message_system;
|
|
|
CREATE TABLE public.message_system(
|
|
|
id bigserial NOT NULL,
|
|
|
company_id int8 NULL, -- 公司ID
|
|
|
recipient_id int8 NULL, -- 接收者ID
|
|
|
"type" int8 NULL, -- 系统分类(0待定、1业务正常通知、2业务异常通知)
|
|
|
title text NULL, -- 标题
|
|
|
"content" text NULL, -- 内容
|
|
|
created_at int8 NULL, -- 创建时间
|
|
|
updated_at int8 NULL, -- 更新时间
|
|
|
deleted_at int8 NULL, -- 删除时间
|
|
|
"version" int8 NULL, -- 版本
|
|
|
is_del int8 NULL, -- 是否删除
|
|
|
CONSTRAINT message_system_pkey PRIMARY KEY (id)
|
|
|
);
|
|
|
|
|
|
-- Column comments
|
|
|
COMMENT ON COLUMN public.message_system.company_id IS '公司ID';
|
|
|
|
|
|
COMMENT ON COLUMN public.message_system.recipient_id IS '接收者ID';
|
|
|
|
|
|
COMMENT ON COLUMN public.message_system. "type" IS '系统分类(0待定、1业务正常通知、2业务异常通知)';
|
|
|
|
|
|
COMMENT ON COLUMN public.message_system.title IS '标题';
|
|
|
|
|
|
COMMENT ON COLUMN public.message_system. "content" IS '内容';
|
|
|
|
|
|
COMMENT ON COLUMN public.message_system.created_at IS '创建时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.message_system.updated_at IS '更新时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.message_system.deleted_at IS '删除时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.message_system. "version" IS '版本';
|
|
|
|
|
|
COMMENT ON COLUMN public.message_system.is_del IS '是否删除';
|
|
|
|
|
|
-- public."role" definition
|
|
|
-- Drop table
|
|
|
-- DROP TABLE public."role";
|
|
|
CREATE TABLE public."role"(
|
|
|
id bigserial NOT NULL, -- ID
|
|
|
"name" text NULL, -- 角色名称
|
|
|
auths jsonb NULL, -- 角色权限列表
|
|
|
remark text NULL, -- 备注
|
|
|
users jsonb NULL, -- 绑定的用户
|
|
|
created_at int8 NULL, -- 创建时间
|
|
|
updated_at int8 NULL, -- 更新时间
|
|
|
deleted_at int8 NULL, -- 删除时间
|
|
|
"version" int8 NULL, -- 版本
|
|
|
is_del int8 NULL, -- 是否删除
|
|
|
company_id int8 NULL, -- 公司ID
|
|
|
CONSTRAINT role_pkey PRIMARY KEY (id)
|
|
|
);
|
|
|
|
|
|
CREATE INDEX idx_role_company_id ON public.role USING btree(company_id);
|
|
|
|
|
|
-- Column comments
|
|
|
COMMENT ON COLUMN public."role".id IS 'ID';
|
|
|
|
|
|
COMMENT ON COLUMN public."role"."name" IS '角色名称';
|
|
|
|
|
|
COMMENT ON COLUMN public."role".auths IS '角色权限列表';
|
|
|
|
|
|
COMMENT ON COLUMN public."role".remark IS '备注';
|
|
|
|
|
|
COMMENT ON COLUMN public."role".users IS '绑定的用户';
|
|
|
|
|
|
COMMENT ON COLUMN public."role".created_at IS '创建时间';
|
|
|
|
|
|
COMMENT ON COLUMN public."role".updated_at IS '更新时间';
|
|
|
|
|
|
COMMENT ON COLUMN public."role".deleted_at IS '删除时间';
|
|
|
|
|
|
COMMENT ON COLUMN public."role"."version" IS '版本';
|
|
|
|
|
|
COMMENT ON COLUMN public."role".is_del IS '是否删除';
|
|
|
|
|
|
COMMENT ON COLUMN public."role".company_id IS '公司ID';
|
|
|
|
|
|
-- public."user" definition
|
|
|
-- Drop table
|
|
|
-- DROP TABLE public."user";
|
|
|
CREATE TABLE public."user"(
|
|
|
id bigserial NOT NULL, -- 唯一标识
|
|
|
company_id int8 NULL, -- 公司ID
|
|
|
roles jsonb NULL, -- 角色
|
|
|
flag int8 NULL, -- 标识 1:管理员 2:普通用户 (有绑定角色是管理员)
|
|
|
"name" text NULL, -- 名称
|
|
|
avatar text NULL, -- 头像
|
|
|
phone text NULL, -- 手机号 唯一
|
|
|
"position" text NULL, -- 职位
|
|
|
"enable" int8 NULL, -- 启用状态 1:启用 2:禁用
|
|
|
audit_status int8 NULL, -- 审核状态 0:待审核 1:审核通过 2:拒绝
|
|
|
follower jsonb NULL, -- 关注我的人 (冗余)
|
|
|
"following" jsonb NULL, -- 我关注的人 (冗余)
|
|
|
created_at int8 NULL, -- 创建时间
|
|
|
updated_at int8 NULL, -- 更新时间
|
|
|
deleted_at int8 NULL, -- 删除时间
|
|
|
"version" int8 NULL, -- 版本
|
|
|
is_del int8 NULL, -- 是否删除
|
|
|
departments jsonb NULL, -- 所属部门
|
|
|
account_from text NULL, -- 账号来源 后台新增、扫码注册
|
|
|
pin_yin_name text NULL, -- 拼音
|
|
|
audit_at int8 NULL,
|
|
|
CONSTRAINT user_pkey PRIMARY KEY (id)
|
|
|
);
|
|
|
|
|
|
CREATE INDEX idx_user_company_id ON public."user" USING btree(company_id);
|
|
|
|
|
|
CREATE INDEX idx_user_phone ON public."user" USING btree(phone);
|
|
|
|
|
|
-- Column comments
|
|
|
COMMENT ON COLUMN public."user".id IS '唯一标识';
|
|
|
|
|
|
COMMENT ON COLUMN public."user".company_id IS '公司ID';
|
|
|
|
|
|
COMMENT ON COLUMN public."user".roles IS '角色';
|
|
|
|
|
|
COMMENT ON COLUMN public."user".flag IS '标识 1:管理员 2:普通用户 (有绑定角色是管理员)';
|
|
|
|
|
|
COMMENT ON COLUMN public."user"."name" IS '名称';
|
|
|
|
|
|
COMMENT ON COLUMN public."user".avatar IS '头像';
|
|
|
|
|
|
COMMENT ON COLUMN public."user".phone IS '手机号 唯一';
|
|
|
|
|
|
COMMENT ON COLUMN public."user"."position" IS '职位';
|
|
|
|
|
|
COMMENT ON COLUMN public."user"."enable" IS '启用状态 1:启用 2:禁用';
|
|
|
|
|
|
COMMENT ON COLUMN public."user".audit_status IS '审核状态 0:待审核 1:审核通过 2:拒绝';
|
|
|
|
|
|
COMMENT ON COLUMN public."user".follower IS '关注我的人 (冗余)';
|
|
|
|
|
|
COMMENT ON COLUMN public."user"."following" IS '我关注的人 (冗余)';
|
|
|
|
|
|
COMMENT ON COLUMN public."user".created_at IS '创建时间';
|
|
|
|
|
|
COMMENT ON COLUMN public."user".updated_at IS '更新时间';
|
|
|
|
|
|
COMMENT ON COLUMN public."user".deleted_at IS '删除时间';
|
|
|
|
|
|
COMMENT ON COLUMN public."user"."version" IS '版本';
|
|
|
|
|
|
COMMENT ON COLUMN public."user".is_del IS '是否删除';
|
|
|
|
|
|
COMMENT ON COLUMN public."user".departments IS '所属部门';
|
|
|
|
|
|
COMMENT ON COLUMN public."user".account_from IS '账号来源 后台新增、扫码注册';
|
|
|
|
|
|
COMMENT ON COLUMN public."user".pin_yin_name IS '拼音';
|
|
|
|
|
|
-- public.user_follow definition
|
|
|
-- Drop table
|
|
|
-- DROP TABLE public.user_follow;
|
|
|
CREATE TABLE public.user_follow(
|
|
|
id bigserial NOT NULL,
|
|
|
created_at int8 NULL,
|
|
|
updated_at int8 NULL,
|
|
|
deleted_at int8 NULL,
|
|
|
"version" int8 NULL,
|
|
|
from_user_id int8 NULL,
|
|
|
to_user_id int8 NULL,
|
|
|
last_read_at int8 NULL,
|
|
|
CONSTRAINT user_follow_pkey PRIMARY KEY (id)
|
|
|
);
|
|
|
|
|
|
CREATE INDEX idx_user_follow_from_user_id ON public.user_follow USING btree(from_user_id);
|
|
|
|
|
|
-- public.user_love_flag definition
|
|
|
-- Drop table
|
|
|
-- DROP TABLE public.user_love_flag;
|
|
|
CREATE TABLE public.user_love_flag(
|
|
|
id bigserial NOT NULL,
|
|
|
article_id int8 NULL, -- 点赞文章时,文章id
|
|
|
comment_id int8 NULL, -- 点赞评论时,填评论id
|
|
|
user_id int8 NULL, -- 用户ID,谁点赞
|
|
|
created_at int8 NULL, -- 创建时间
|
|
|
updated_at int8 NULL, -- 更新时间
|
|
|
deleted_at int8 NULL, -- 删除时间
|
|
|
"version" int8 NULL, -- 版本
|
|
|
is_del int8 NULL, -- 是否删除
|
|
|
article_author int8 NULL, -- 文章作者id
|
|
|
comment_author int8 NULL, -- 填写评论的人员id
|
|
|
to_user_id int8 NULL, -- 点赞的接受人
|
|
|
company_id int8 NULL DEFAULT 0,
|
|
|
CONSTRAINT user_love_flag_pkey PRIMARY KEY (id)
|
|
|
);
|
|
|
|
|
|
CREATE INDEX user_love_flag_comment_id_idx ON public.user_love_flag USING btree(comment_id);
|
|
|
|
|
|
CREATE INDEX user_love_flag_user_id_idx ON public.user_love_flag USING btree(user_id);
|
|
|
|
|
|
-- Column comments
|
|
|
COMMENT ON COLUMN public.user_love_flag.article_id IS '点赞文章时,文章id';
|
|
|
|
|
|
COMMENT ON COLUMN public.user_love_flag.comment_id IS '点赞评论时,填评论id';
|
|
|
|
|
|
COMMENT ON COLUMN public.user_love_flag.user_id IS '用户ID,谁点赞';
|
|
|
|
|
|
COMMENT ON COLUMN public.user_love_flag.created_at IS '创建时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.user_love_flag.updated_at IS '更新时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.user_love_flag.deleted_at IS '删除时间';
|
|
|
|
|
|
COMMENT ON COLUMN public.user_love_flag. "version" IS '版本';
|
|
|
|
|
|
COMMENT ON COLUMN public.user_love_flag.is_del IS '是否删除';
|
|
|
|
|
|
COMMENT ON COLUMN public.user_love_flag.article_author IS '文章作者id';
|
|
|
|
|
|
COMMENT ON COLUMN public.user_love_flag.comment_author IS '填写评论的人员id';
|
|
|
|
|
|
COMMENT ON COLUMN public.user_love_flag.to_user_id IS '点赞的接受人';
|
|
|
|
|
|
-- public.user_read_article definition
|
|
|
-- Drop table
|
|
|
-- DROP TABLE public.user_read_article;
|
|
|
CREATE TABLE public.user_read_article(
|
|
|
id bigserial NOT NULL,
|
|
|
created_at int8 NULL,
|
|
|
updated_at int8 NULL,
|
|
|
deleted_at int8 NULL,
|
|
|
"version" int8 NULL,
|
|
|
company_id int8 NULL,
|
|
|
user_id int8 NULL,
|
|
|
article_id int8 NULL,
|
|
|
title text NULL,
|
|
|
author jsonb NULL DEFAULT '{}' ::jsonb,
|
|
|
is_del int8 NULL DEFAULT 0,
|
|
|
CONSTRAINT user_read_article_pkey PRIMARY KEY (id)
|
|
|
);
|
|
|
|
|
|
CREATE INDEX user_read_article_company_id_idx ON public.user_read_article USING btree(company_id);
|
|
|
|
|
|
CREATE INDEX user_read_article_user_id_idx ON public.user_read_article USING btree(user_id);
|
|
|
|
|
|
-- public.user_role definition
|
|
|
-- Drop table
|
|
|
-- DROP TABLE public.user_role;
|
|
|
CREATE TABLE public.user_role(
|
|
|
id bigserial NOT NULL,
|
|
|
company_id int8 NULL,
|
|
|
user_id int8 NULL,
|
|
|
role_id int8 NULL,
|
|
|
created_at int8 NULL,
|
|
|
updated_at int8 NULL,
|
|
|
deleted_at int8 NULL,
|
|
|
"version" int8 NULL,
|
|
|
CONSTRAINT user_role_pkey PRIMARY KEY (id)
|
|
|
);
|
|
|
|
|
|
-- public.user_simples definition
|
|
|
-- Drop table
|
|
|
-- DROP TABLE public.user_simples;
|
|
|
CREATE TABLE public.user_simples(
|
|
|
id bigserial NOT NULL,
|
|
|
"name" text NULL,
|
|
|
avatar text NULL,
|
|
|
"group" text NULL,
|
|
|
"position" text NULL,
|
|
|
CONSTRAINT user_simples_pkey PRIMARY KEY (id)
|
|
|
);
|
|
|
|
...
|
...
|
|