|
|
1
|
+-- 创建新表 summary_evaluation
|
|
|
2
|
+CREATE TABLE public.summary_evaluation (
|
|
|
3
|
+ id bigserial NOT NULL,
|
|
|
4
|
+ company_id int8 NULL,
|
|
|
5
|
+ evaluation_project_id int8 NULL,
|
|
|
6
|
+ evaluation_project_name text NULL,
|
|
|
7
|
+ cycle_id int8 NULL,
|
|
|
8
|
+ cycle_name text NULL,
|
|
|
9
|
+ target_user jsonb NULL,
|
|
|
10
|
+ target_department jsonb NULL,
|
|
|
11
|
+ executor jsonb NULL,
|
|
|
12
|
+ "types" int8 NULL,
|
|
|
13
|
+ status text NULL,
|
|
|
14
|
+ check_result text NULL,
|
|
|
15
|
+ begin_time timestamptz NULL,
|
|
|
16
|
+ end_time timestamptz NULL,
|
|
|
17
|
+ total_score text NULL,
|
|
|
18
|
+ created_at timestamptz NULL,
|
|
|
19
|
+ updated_at timestamptz NULL,
|
|
|
20
|
+ deleted_at timestamptz NULL,
|
|
|
21
|
+ node_id int8 NULL DEFAULT 0,
|
|
|
22
|
+ total_rating jsonb NULL,
|
|
|
23
|
+ CONSTRAINT summary_evaluation_pkey PRIMARY KEY (id)
|
|
|
24
|
+);
|
|
|
25
|
+
|
|
|
26
|
+-- 创建新表 summary_evaluation_value
|
|
|
27
|
+CREATE TABLE public.summary_evaluation_value (
|
|
|
28
|
+ id bigserial NOT NULL,
|
|
|
29
|
+ evaluation_item_id int8 NULL,
|
|
|
30
|
+ summary_evaluation_id int8 NULL,
|
|
|
31
|
+ value text NULL,
|
|
|
32
|
+ score text NULL,
|
|
|
33
|
+ "types" int8 NULL,
|
|
|
34
|
+ remark text NULL,
|
|
|
35
|
+ created_at timestamptz NULL,
|
|
|
36
|
+ updated_at timestamptz NULL,
|
|
|
37
|
+ weight numeric NULL DEFAULT 0,
|
|
|
38
|
+ rating jsonb NULL,
|
|
|
39
|
+ CONSTRAINT summary_evaluation_value_pkey PRIMARY KEY (id)
|
|
|
40
|
+);
|
|
|
41
|
+
|
|
|
42
|
+-- 创建新表 evaluation_item_used
|
|
|
43
|
+CREATE TABLE public.evaluation_item_used (
|
|
|
44
|
+ id bigserial NOT NULL,
|
|
|
45
|
+ company_id int8 NULL,
|
|
|
46
|
+ evaluation_project_id int8 NULL,
|
|
|
47
|
+ node_id int8 NULL,
|
|
|
48
|
+ node_type int8 NULL,
|
|
|
49
|
+ sort_by int8 NULL,
|
|
|
50
|
+ category text NULL,
|
|
|
51
|
+ "name" text NULL,
|
|
|
52
|
+ prompt_title text NULL,
|
|
|
53
|
+ prompt_text text NULL,
|
|
|
54
|
+ entry_items jsonb NULL,
|
|
|
55
|
+ rule_type int8 NULL,
|
|
|
56
|
+ "rule" jsonb NULL,
|
|
|
57
|
+ weight numeric NULL DEFAULT 0,
|
|
|
58
|
+ required int8 NULL,
|
|
|
59
|
+ created_at timestamptz NULL,
|
|
|
60
|
+ updated_at timestamptz NULL,
|
|
|
61
|
+ evaluator_id int8 NULL DEFAULT 0,
|
|
|
62
|
+ CONSTRAINT evaluation_item_used_pkey PRIMARY KEY (id)
|
|
|
63
|
+);
|
|
|
64
|
+
|
|
|
65
|
+-- 创建新表 log_sms
|
|
|
66
|
+CREATE TABLE public.log_sms (
|
|
|
67
|
+ id bigserial NOT NULL,
|
|
|
68
|
+ phone text NULL,
|
|
|
69
|
+ template_id int8 NULL,
|
|
|
70
|
+ "template" text NULL,
|
|
|
71
|
+ value jsonb NULL,
|
|
|
72
|
+ created_at timestamptz NULL,
|
|
|
73
|
+ "result" text NULL,
|
|
|
74
|
+ status text NULL,
|
|
|
75
|
+ "from" text NULL,
|
|
|
76
|
+ "index" int8 NULL,
|
|
|
77
|
+ execute_at timestamptz NULL,
|
|
|
78
|
+ CONSTRAINT log_sms_pkey PRIMARY KEY (id)
|
|
|
79
|
+);
|
|
|
80
|
+
|
|
|
81
|
+-- 变更evaluation_project表字段
|
|
|
82
|
+ALTER TABLE public.evaluation_project
|
|
|
83
|
+ ADD summary_state int4 NOT NULL DEFAULT 0;
|
|
|
84
|
+
|
|
|
85
|
+COMMENT ON COLUMN public.evaluation_project.summary_state IS '周期评估是否下发';
|
|
|
86
|
+
|
1
|
-- 变更user表字段
|
87
|
-- 变更user表字段
|
2
|
ALTER TABLE "public"."user"
|
88
|
ALTER TABLE "public"."user"
|
3
|
ADD COLUMN "parent_id" int8 DEFAULT 0;
|
89
|
ADD COLUMN "parent_id" int8 DEFAULT 0;
|
4
|
|
90
|
|
5
|
COMMENT ON COLUMN "public"."user"."parent_id" IS '上级ID';
|
91
|
COMMENT ON COLUMN "public"."user"."parent_id" IS '上级ID';
|
6
|
|
92
|
|
7
|
--- 抽取旧数据到evaluation_item_used
|
93
|
+-- 抽取evaluation_project旧数据到evaluation_item_used
|
8
|
WITH t1 AS (
|
94
|
WITH t1 AS (
|
9
|
SELECT
|
95
|
SELECT
|
10
|
evaluation_project.company_id,
|
96
|
evaluation_project.company_id,
|