@opengis/fastify-table 1.1.14 → 1.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +5 -1
- package/README.md +26 -26
- package/config.js +10 -10
- package/cron/controllers/cronApi.js +22 -22
- package/cron/controllers/utils/cronList.js +1 -1
- package/cron/funcs/addCron.js +131 -131
- package/cron/index.js +10 -10
- package/crud/controllers/utils/checkXSS.js +45 -45
- package/crud/controllers/utils/xssInjection.js +72 -72
- package/crud/funcs/dataUpdate.js +1 -1
- package/crud/funcs/getToken.js +27 -27
- package/crud/funcs/isFileExists.js +13 -13
- package/crud/funcs/setToken.js +53 -53
- package/notification/controllers/testEmail.js +49 -49
- package/notification/funcs/utils/sendEmail.js +39 -39
- package/notification/index.js +38 -38
- package/package.json +1 -1
- package/pg/funcs/getPG.js +30 -30
- package/redis/funcs/getRedis.js +23 -23
- package/server/migrations/crm.sql +150 -150
- package/server/migrations/log.sql +80 -80
- package/server/migrations/properties.sql +28 -1
- package/server/migrations/users.sql +45 -0
- package/server.js +14 -14
- package/table/controllers/card.js +44 -44
- package/table/controllers/form.js +28 -28
- package/test/api/crud.xss.test.js +72 -72
- package/test/api/notification.test.js +37 -37
- package/test/config.example +18 -18
- package/test/funcs/pg.test.js +34 -34
- package/test/funcs/redis.test.js +19 -19
- package/test/templates/cls/test.json +9 -9
- package/test/templates/form/cp_building.form.json +32 -32
- package/test/templates/select/account_id.json +3 -3
- package/test/templates/select/storage.data.json +2 -2
- package/test/templates/table/gis.dataset.table.json +20 -20
- package/util/controllers/logger.file.js +90 -90
- package/util/controllers/next.id.js +4 -4
- package/util/controllers/properties.get.js +19 -19
- package/util/controllers/utils/checkUserAccess.js +19 -19
- package/util/controllers/utils/getRootDir.js +20 -20
- package/util/index.js +23 -23
|
@@ -1,150 +1,150 @@
|
|
|
1
|
-
create schema if not exists crm;
|
|
2
|
-
|
|
3
|
-
-- crm.notifications
|
|
4
|
-
-- DROP TABLE IF EXISTS crm.notifications;
|
|
5
|
-
CREATE TABLE IF NOT EXISTS crm.notifications();
|
|
6
|
-
ALTER TABLE crm.notifications DROP CONSTRAINT IF EXISTS crm_notifications_pkey;
|
|
7
|
-
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS notification_id text NOT NULL DEFAULT next_id();
|
|
8
|
-
|
|
9
|
-
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS notification_user_id text;
|
|
10
|
-
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS notification_type text DEFAULT 'notify'::text;
|
|
11
|
-
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS notification_status text DEFAULT 'not sent'::text;
|
|
12
|
-
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS subject text;
|
|
13
|
-
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS body text;
|
|
14
|
-
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS link text;
|
|
15
|
-
|
|
16
|
-
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS uid text;
|
|
17
|
-
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS files json;
|
|
18
|
-
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
|
|
19
|
-
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS editor_id text;
|
|
20
|
-
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
21
|
-
ALTER TABLE crm.notifications ADD CONSTRAINT crm_notifications_pkey PRIMARY KEY (notification_id);
|
|
22
|
-
|
|
23
|
-
-- crm.files
|
|
24
|
-
-- DROP TABLE IF EXISTS crm.files;
|
|
25
|
-
CREATE TABLE IF NOT EXISTS crm.files();
|
|
26
|
-
ALTER TABLE crm.files DROP CONSTRAINT IF EXISTS crm_files_pkey;
|
|
27
|
-
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS file_id text NOT NULL DEFAULT next_id();
|
|
28
|
-
|
|
29
|
-
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS uploaded_name text;
|
|
30
|
-
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS entity_id text; -- object_id
|
|
31
|
-
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS entity_type text; -- table_name
|
|
32
|
-
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS file_type text;
|
|
33
|
-
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS file_status numeric;
|
|
34
|
-
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS doc_type text;
|
|
35
|
-
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS subject text; -- title
|
|
36
|
-
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS size numeric;
|
|
37
|
-
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS ext text;
|
|
38
|
-
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS tags text[];
|
|
39
|
-
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS file_path text;
|
|
40
|
-
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS ismain boolean default false;
|
|
41
|
-
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS isverified boolean default false;
|
|
42
|
-
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS uid text;
|
|
43
|
-
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS files json;
|
|
44
|
-
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
|
|
45
|
-
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS editor_id text;
|
|
46
|
-
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
47
|
-
ALTER TABLE crm.files ADD CONSTRAINT crm_files_pkey PRIMARY KEY (file_id);
|
|
48
|
-
|
|
49
|
-
-- crm.communications
|
|
50
|
-
-- DROP TABLE IF EXISTS crm.communications;
|
|
51
|
-
CREATE TABLE IF NOT EXISTS crm.communications();
|
|
52
|
-
ALTER TABLE crm.communications DROP CONSTRAINT IF EXISTS crm_communications_pkey;
|
|
53
|
-
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS communication_id text NOT NULL DEFAULT next_id();
|
|
54
|
-
|
|
55
|
-
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS entity_id text; -- object_id
|
|
56
|
-
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS entity_type text; -- table_name
|
|
57
|
-
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS sender text;
|
|
58
|
-
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS channel text;
|
|
59
|
-
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS participant text;
|
|
60
|
-
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS communication_date date;
|
|
61
|
-
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS expiration_date date;
|
|
62
|
-
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS announcement text;
|
|
63
|
-
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS subject text; -- title
|
|
64
|
-
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS body text;
|
|
65
|
-
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS mark numeric;
|
|
66
|
-
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS parent_id text;
|
|
67
|
-
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS target_id text[];
|
|
68
|
-
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS enabled boolean;
|
|
69
|
-
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS uid text;
|
|
70
|
-
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS files json;
|
|
71
|
-
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
|
|
72
|
-
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS editor_id text;
|
|
73
|
-
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
74
|
-
ALTER TABLE crm.communications ADD CONSTRAINT crm_communications_pkey PRIMARY KEY (communication_id);
|
|
75
|
-
|
|
76
|
-
-- crm.checklists
|
|
77
|
-
-- DROP TABLE IF EXISTS crm.checklists;
|
|
78
|
-
CREATE TABLE IF NOT EXISTS crm.checklists();
|
|
79
|
-
ALTER TABLE crm.checklists DROP CONSTRAINT IF EXISTS crm_checklists_pkey;
|
|
80
|
-
ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS checklist_id text NOT NULL DEFAULT next_id();
|
|
81
|
-
|
|
82
|
-
ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS entity_id text; -- object_id
|
|
83
|
-
ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS entity_type text; -- table_name
|
|
84
|
-
ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS subject text; -- title
|
|
85
|
-
alter table crm.checklists add column IF NOT EXISTS is_done boolean default false;
|
|
86
|
-
alter table crm.checklists add column IF NOT EXISTS done_date date;
|
|
87
|
-
alter table crm.checklists add column IF NOT EXISTS category text;
|
|
88
|
-
alter table crm.checklists add column IF NOT EXISTS body text;
|
|
89
|
-
alter table crm.checklists add column IF NOT EXISTS parent_id text;
|
|
90
|
-
alter table crm.checklists add column IF NOT EXISTS flag boolean;
|
|
91
|
-
|
|
92
|
-
ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS uid text;
|
|
93
|
-
ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS files json;
|
|
94
|
-
ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
|
|
95
|
-
ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS editor_id text;
|
|
96
|
-
ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
97
|
-
ALTER TABLE crm.checklists ADD CONSTRAINT crm_checklists_pkey PRIMARY KEY (checklist_id);
|
|
98
|
-
|
|
99
|
-
-- crm.cls
|
|
100
|
-
-- DROP TABLE IF EXISTS crm.cls;
|
|
101
|
-
CREATE TABLE IF NOT EXISTS crm.cls();
|
|
102
|
-
ALTER TABLE crm.cls DROP CONSTRAINT IF EXISTS crm_cls_pkey;
|
|
103
|
-
ALTER TABLE crm.cls DROP CONSTRAINT IF EXISTS crm_cls_unique;
|
|
104
|
-
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS cls_id text NOT NULL DEFAULT next_id();
|
|
105
|
-
|
|
106
|
-
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS name text;
|
|
107
|
-
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS data text;
|
|
108
|
-
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS type text;
|
|
109
|
-
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS parent text;
|
|
110
|
-
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS code text;
|
|
111
|
-
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS color text;
|
|
112
|
-
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS icon text;
|
|
113
|
-
|
|
114
|
-
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS uid text;
|
|
115
|
-
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS files json;
|
|
116
|
-
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
|
|
117
|
-
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS editor_id text;
|
|
118
|
-
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
119
|
-
ALTER TABLE crm.cls ADD CONSTRAINT crm_cls_pkey PRIMARY KEY (cls_id);
|
|
120
|
-
ALTER TABLE crm.cls ADD CONSTRAINT crm_cls_unique UNIQUE (code, parent);
|
|
121
|
-
|
|
122
|
-
-- DROP TABLE crm.properties;
|
|
123
|
-
CREATE TABLE IF NOT EXISTS crm.properties();
|
|
124
|
-
ALTER TABLE crm.properties DROP CONSTRAINT IF EXISTS crm_properties_pkey;
|
|
125
|
-
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS property_id text NOT NULL DEFAULT next_id();
|
|
126
|
-
|
|
127
|
-
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS table_name text;
|
|
128
|
-
COMMENT ON COLUMN crm.properties.table_name IS 'Таблиця';
|
|
129
|
-
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS object_id text;
|
|
130
|
-
COMMENT ON COLUMN crm.properties.object_id IS 'ID Об''єкту';
|
|
131
|
-
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS property_key text;
|
|
132
|
-
COMMENT ON COLUMN crm.properties.object_id IS 'Назва атрибуту';
|
|
133
|
-
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS property_text text;
|
|
134
|
-
COMMENT ON COLUMN crm.properties.property_text IS 'Текст';
|
|
135
|
-
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS property_int integer;
|
|
136
|
-
COMMENT ON COLUMN crm.properties.property_int IS 'Integer';
|
|
137
|
-
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS property_json json;
|
|
138
|
-
COMMENT ON COLUMN crm.properties.property_json IS 'JSON';
|
|
139
|
-
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS property_date date;
|
|
140
|
-
COMMENT ON COLUMN crm.properties.property_json IS 'Дата';
|
|
141
|
-
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS property_type text;
|
|
142
|
-
COMMENT ON COLUMN crm.properties.property_type IS 'Тип даних';
|
|
143
|
-
|
|
144
|
-
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS uid text NOT NULL DEFAULT '1'::text;
|
|
145
|
-
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS editor_id text;
|
|
146
|
-
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
147
|
-
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT now();
|
|
148
|
-
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS files json;
|
|
149
|
-
|
|
150
|
-
ALTER TABLE crm.properties ADD CONSTRAINT crm_properties_pkey PRIMARY KEY(property_id);
|
|
1
|
+
create schema if not exists crm;
|
|
2
|
+
|
|
3
|
+
-- crm.notifications
|
|
4
|
+
-- DROP TABLE IF EXISTS crm.notifications;
|
|
5
|
+
CREATE TABLE IF NOT EXISTS crm.notifications();
|
|
6
|
+
ALTER TABLE crm.notifications DROP CONSTRAINT IF EXISTS crm_notifications_pkey;
|
|
7
|
+
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS notification_id text NOT NULL DEFAULT next_id();
|
|
8
|
+
|
|
9
|
+
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS notification_user_id text;
|
|
10
|
+
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS notification_type text DEFAULT 'notify'::text;
|
|
11
|
+
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS notification_status text DEFAULT 'not sent'::text;
|
|
12
|
+
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS subject text;
|
|
13
|
+
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS body text;
|
|
14
|
+
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS link text;
|
|
15
|
+
|
|
16
|
+
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS uid text;
|
|
17
|
+
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS files json;
|
|
18
|
+
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
|
|
19
|
+
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS editor_id text;
|
|
20
|
+
ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
21
|
+
ALTER TABLE crm.notifications ADD CONSTRAINT crm_notifications_pkey PRIMARY KEY (notification_id);
|
|
22
|
+
|
|
23
|
+
-- crm.files
|
|
24
|
+
-- DROP TABLE IF EXISTS crm.files;
|
|
25
|
+
CREATE TABLE IF NOT EXISTS crm.files();
|
|
26
|
+
ALTER TABLE crm.files DROP CONSTRAINT IF EXISTS crm_files_pkey;
|
|
27
|
+
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS file_id text NOT NULL DEFAULT next_id();
|
|
28
|
+
|
|
29
|
+
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS uploaded_name text;
|
|
30
|
+
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS entity_id text; -- object_id
|
|
31
|
+
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS entity_type text; -- table_name
|
|
32
|
+
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS file_type text;
|
|
33
|
+
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS file_status numeric;
|
|
34
|
+
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS doc_type text;
|
|
35
|
+
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS subject text; -- title
|
|
36
|
+
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS size numeric;
|
|
37
|
+
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS ext text;
|
|
38
|
+
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS tags text[];
|
|
39
|
+
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS file_path text;
|
|
40
|
+
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS ismain boolean default false;
|
|
41
|
+
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS isverified boolean default false;
|
|
42
|
+
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS uid text;
|
|
43
|
+
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS files json;
|
|
44
|
+
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
|
|
45
|
+
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS editor_id text;
|
|
46
|
+
ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
47
|
+
ALTER TABLE crm.files ADD CONSTRAINT crm_files_pkey PRIMARY KEY (file_id);
|
|
48
|
+
|
|
49
|
+
-- crm.communications
|
|
50
|
+
-- DROP TABLE IF EXISTS crm.communications;
|
|
51
|
+
CREATE TABLE IF NOT EXISTS crm.communications();
|
|
52
|
+
ALTER TABLE crm.communications DROP CONSTRAINT IF EXISTS crm_communications_pkey;
|
|
53
|
+
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS communication_id text NOT NULL DEFAULT next_id();
|
|
54
|
+
|
|
55
|
+
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS entity_id text; -- object_id
|
|
56
|
+
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS entity_type text; -- table_name
|
|
57
|
+
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS sender text;
|
|
58
|
+
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS channel text;
|
|
59
|
+
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS participant text;
|
|
60
|
+
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS communication_date date;
|
|
61
|
+
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS expiration_date date;
|
|
62
|
+
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS announcement text;
|
|
63
|
+
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS subject text; -- title
|
|
64
|
+
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS body text;
|
|
65
|
+
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS mark numeric;
|
|
66
|
+
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS parent_id text;
|
|
67
|
+
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS target_id text[];
|
|
68
|
+
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS enabled boolean;
|
|
69
|
+
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS uid text;
|
|
70
|
+
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS files json;
|
|
71
|
+
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
|
|
72
|
+
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS editor_id text;
|
|
73
|
+
ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
74
|
+
ALTER TABLE crm.communications ADD CONSTRAINT crm_communications_pkey PRIMARY KEY (communication_id);
|
|
75
|
+
|
|
76
|
+
-- crm.checklists
|
|
77
|
+
-- DROP TABLE IF EXISTS crm.checklists;
|
|
78
|
+
CREATE TABLE IF NOT EXISTS crm.checklists();
|
|
79
|
+
ALTER TABLE crm.checklists DROP CONSTRAINT IF EXISTS crm_checklists_pkey;
|
|
80
|
+
ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS checklist_id text NOT NULL DEFAULT next_id();
|
|
81
|
+
|
|
82
|
+
ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS entity_id text; -- object_id
|
|
83
|
+
ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS entity_type text; -- table_name
|
|
84
|
+
ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS subject text; -- title
|
|
85
|
+
alter table crm.checklists add column IF NOT EXISTS is_done boolean default false;
|
|
86
|
+
alter table crm.checklists add column IF NOT EXISTS done_date date;
|
|
87
|
+
alter table crm.checklists add column IF NOT EXISTS category text;
|
|
88
|
+
alter table crm.checklists add column IF NOT EXISTS body text;
|
|
89
|
+
alter table crm.checklists add column IF NOT EXISTS parent_id text;
|
|
90
|
+
alter table crm.checklists add column IF NOT EXISTS flag boolean;
|
|
91
|
+
|
|
92
|
+
ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS uid text;
|
|
93
|
+
ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS files json;
|
|
94
|
+
ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
|
|
95
|
+
ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS editor_id text;
|
|
96
|
+
ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
97
|
+
ALTER TABLE crm.checklists ADD CONSTRAINT crm_checklists_pkey PRIMARY KEY (checklist_id);
|
|
98
|
+
|
|
99
|
+
-- crm.cls
|
|
100
|
+
-- DROP TABLE IF EXISTS crm.cls;
|
|
101
|
+
CREATE TABLE IF NOT EXISTS crm.cls();
|
|
102
|
+
ALTER TABLE crm.cls DROP CONSTRAINT IF EXISTS crm_cls_pkey;
|
|
103
|
+
ALTER TABLE crm.cls DROP CONSTRAINT IF EXISTS crm_cls_unique;
|
|
104
|
+
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS cls_id text NOT NULL DEFAULT next_id();
|
|
105
|
+
|
|
106
|
+
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS name text;
|
|
107
|
+
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS data text;
|
|
108
|
+
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS type text;
|
|
109
|
+
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS parent text;
|
|
110
|
+
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS code text;
|
|
111
|
+
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS color text;
|
|
112
|
+
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS icon text;
|
|
113
|
+
|
|
114
|
+
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS uid text;
|
|
115
|
+
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS files json;
|
|
116
|
+
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
|
|
117
|
+
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS editor_id text;
|
|
118
|
+
ALTER TABLE crm.cls ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
119
|
+
ALTER TABLE crm.cls ADD CONSTRAINT crm_cls_pkey PRIMARY KEY (cls_id);
|
|
120
|
+
ALTER TABLE crm.cls ADD CONSTRAINT crm_cls_unique UNIQUE (code, parent);
|
|
121
|
+
|
|
122
|
+
-- DROP TABLE crm.properties;
|
|
123
|
+
CREATE TABLE IF NOT EXISTS crm.properties();
|
|
124
|
+
ALTER TABLE crm.properties DROP CONSTRAINT IF EXISTS crm_properties_pkey;
|
|
125
|
+
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS property_id text NOT NULL DEFAULT next_id();
|
|
126
|
+
|
|
127
|
+
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS table_name text;
|
|
128
|
+
COMMENT ON COLUMN crm.properties.table_name IS 'Таблиця';
|
|
129
|
+
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS object_id text;
|
|
130
|
+
COMMENT ON COLUMN crm.properties.object_id IS 'ID Об''єкту';
|
|
131
|
+
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS property_key text;
|
|
132
|
+
COMMENT ON COLUMN crm.properties.object_id IS 'Назва атрибуту';
|
|
133
|
+
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS property_text text;
|
|
134
|
+
COMMENT ON COLUMN crm.properties.property_text IS 'Текст';
|
|
135
|
+
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS property_int integer;
|
|
136
|
+
COMMENT ON COLUMN crm.properties.property_int IS 'Integer';
|
|
137
|
+
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS property_json json;
|
|
138
|
+
COMMENT ON COLUMN crm.properties.property_json IS 'JSON';
|
|
139
|
+
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS property_date date;
|
|
140
|
+
COMMENT ON COLUMN crm.properties.property_json IS 'Дата';
|
|
141
|
+
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS property_type text;
|
|
142
|
+
COMMENT ON COLUMN crm.properties.property_type IS 'Тип даних';
|
|
143
|
+
|
|
144
|
+
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS uid text NOT NULL DEFAULT '1'::text;
|
|
145
|
+
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS editor_id text;
|
|
146
|
+
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
147
|
+
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT now();
|
|
148
|
+
ALTER TABLE crm.properties ADD COLUMN IF NOT EXISTS files json;
|
|
149
|
+
|
|
150
|
+
ALTER TABLE crm.properties ADD CONSTRAINT crm_properties_pkey PRIMARY KEY(property_id);
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
create schema if not exists log;
|
|
2
|
-
|
|
3
|
-
-- DROP TABLE IF EXISTS log.table_changes cascade;
|
|
4
|
-
CREATE TABLE IF NOT EXISTS log.table_changes();
|
|
5
|
-
ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_id text NOT NULL DEFAULT next_id();
|
|
6
|
-
ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_type text;
|
|
7
|
-
ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_date date;
|
|
8
|
-
ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_user_id text;
|
|
9
|
-
ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS entity_type text; -- table_name
|
|
10
|
-
ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS entity_id text; -- object_id
|
|
11
|
-
ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS uid text;
|
|
12
|
-
ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
|
|
13
|
-
ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS editor_id text;
|
|
14
|
-
ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
15
|
-
|
|
16
|
-
-- DROP TABLE IF EXISTS log.table_changes_data;
|
|
17
|
-
CREATE TABLE IF NOT EXISTS log.table_changes_data();
|
|
18
|
-
ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS change_data_id text NOT NULL DEFAULT next_id();
|
|
19
|
-
ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS change_id text not null;
|
|
20
|
-
ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS entity_key text; -- column_name
|
|
21
|
-
ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS value_old text;
|
|
22
|
-
ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS value_new text;
|
|
23
|
-
ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS uid text;
|
|
24
|
-
ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
|
|
25
|
-
ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS editor_id text;
|
|
26
|
-
ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
27
|
-
|
|
28
|
-
-- DROP TABLE IF EXISTS log.user_auth;
|
|
29
|
-
CREATE TABLE IF NOT EXISTS log.user_auth();
|
|
30
|
-
ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS user_auth_id text NOT NULL DEFAULT next_id();
|
|
31
|
-
ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS user_id text;
|
|
32
|
-
ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS auth_date timestamp without time zone;
|
|
33
|
-
ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS auth_type text;
|
|
34
|
-
ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS uid text;
|
|
35
|
-
ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
|
|
36
|
-
ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS editor_id text;
|
|
37
|
-
ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
38
|
-
|
|
39
|
-
COMMENT ON TABLE log.table_changes IS 'Логи подій змін в БД';
|
|
40
|
-
COMMENT ON COLUMN log.table_changes.change_type IS 'Тип події (insert / update / delete)';
|
|
41
|
-
COMMENT ON COLUMN log.table_changes.change_date IS 'Дата внесення змін до БД';
|
|
42
|
-
COMMENT ON COLUMN log.table_changes.entity_type IS 'Таблиця, до якої вносяться зміни';
|
|
43
|
-
COMMENT ON COLUMN log.table_changes.entity_id IS 'ID строки, до якої вносяться зміни';
|
|
44
|
-
COMMENT ON COLUMN log.table_changes.change_user_id IS 'Ініціатор внесення змін';
|
|
45
|
-
|
|
46
|
-
COMMENT ON TABLE log.table_changes_data IS 'Логи змін в таблицях БД';
|
|
47
|
-
COMMENT ON COLUMN log.table_changes_data.change_id IS 'ID події зміни в БД';
|
|
48
|
-
COMMENT ON COLUMN log.table_changes_data.entity_key IS 'Колонка таблиці, до якої вносяться зміни';
|
|
49
|
-
COMMENT ON COLUMN log.table_changes_data.value_old IS 'Старе значення';
|
|
50
|
-
COMMENT ON COLUMN log.table_changes_data.value_new IS 'Нове значення';
|
|
51
|
-
|
|
52
|
-
COMMENT ON TABLE log.user_auth IS 'Логи авторизації';
|
|
53
|
-
COMMENT ON COLUMN log.user_auth.user_id IS 'ID користувача';
|
|
54
|
-
COMMENT ON COLUMN log.user_auth.auth_date IS 'Дата авторизації';
|
|
55
|
-
COMMENT ON COLUMN log.user_auth.auth_type IS 'Тип авторизації';
|
|
56
|
-
|
|
57
|
-
ALTER TABLE log.table_changes DROP CONSTRAINT IF EXISTS log_table_changes_pkey cascade;
|
|
58
|
-
ALTER TABLE log.table_changes_data DROP CONSTRAINT IF EXISTS log_table_changes_data_pkey;
|
|
59
|
-
ALTER TABLE log.table_changes_data DROP CONSTRAINT IF EXISTS log_table_changes_data_change_id_fkey;
|
|
60
|
-
ALTER TABLE log.user_auth DROP CONSTRAINT IF EXISTS log_user_auth_pkey;
|
|
61
|
-
ALTER TABLE log.user_auth DROP CONSTRAINT IF EXISTS log_user_auth_user_id_fkey;
|
|
62
|
-
|
|
63
|
-
ALTER TABLE log.table_changes ADD CONSTRAINT log_table_changes_pkey PRIMARY KEY (change_id);
|
|
64
|
-
ALTER TABLE log.table_changes_data ADD CONSTRAINT log_table_changes_data_pkey PRIMARY KEY (change_data_id);
|
|
65
|
-
ALTER TABLE log.table_changes_data ADD CONSTRAINT log_table_changes_data_change_id_fkey FOREIGN KEY (change_id)
|
|
66
|
-
REFERENCES log.table_changes (change_id);
|
|
67
|
-
ALTER TABLE log.user_auth ADD CONSTRAINT log_user_auth_pkey PRIMARY KEY (user_auth_id);
|
|
68
|
-
-- ALTER TABLE log.user_auth ADD CONSTRAINT log_user_auth_user_id_fkey FOREIGN KEY (user_id) REFERENCES admin.users (uid) MATCH SIMPLE;
|
|
69
|
-
|
|
70
|
-
/* drop old columns */
|
|
71
|
-
alter table log.table_changes drop column if exists date_new;
|
|
72
|
-
alter table log.table_changes drop column if exists date_old;
|
|
73
|
-
alter table log.table_changes drop column if exists number_new;
|
|
74
|
-
alter table log.table_changes drop column if exists number_old;
|
|
75
|
-
alter table log.table_changes drop column if exists json_new;
|
|
76
|
-
alter table log.table_changes drop column if exists json_old;
|
|
77
|
-
alter table log.table_changes drop column if exists text_new;
|
|
78
|
-
alter table log.table_changes drop column if exists text_old;
|
|
79
|
-
alter table log.table_changes drop column if exists bool_new;
|
|
80
|
-
alter table log.table_changes drop column if exists bool_old;
|
|
1
|
+
create schema if not exists log;
|
|
2
|
+
|
|
3
|
+
-- DROP TABLE IF EXISTS log.table_changes cascade;
|
|
4
|
+
CREATE TABLE IF NOT EXISTS log.table_changes();
|
|
5
|
+
ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_id text NOT NULL DEFAULT next_id();
|
|
6
|
+
ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_type text;
|
|
7
|
+
ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_date date;
|
|
8
|
+
ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_user_id text;
|
|
9
|
+
ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS entity_type text; -- table_name
|
|
10
|
+
ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS entity_id text; -- object_id
|
|
11
|
+
ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS uid text;
|
|
12
|
+
ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
|
|
13
|
+
ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS editor_id text;
|
|
14
|
+
ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
15
|
+
|
|
16
|
+
-- DROP TABLE IF EXISTS log.table_changes_data;
|
|
17
|
+
CREATE TABLE IF NOT EXISTS log.table_changes_data();
|
|
18
|
+
ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS change_data_id text NOT NULL DEFAULT next_id();
|
|
19
|
+
ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS change_id text not null;
|
|
20
|
+
ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS entity_key text; -- column_name
|
|
21
|
+
ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS value_old text;
|
|
22
|
+
ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS value_new text;
|
|
23
|
+
ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS uid text;
|
|
24
|
+
ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
|
|
25
|
+
ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS editor_id text;
|
|
26
|
+
ALTER TABLE log.table_changes_data ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
27
|
+
|
|
28
|
+
-- DROP TABLE IF EXISTS log.user_auth;
|
|
29
|
+
CREATE TABLE IF NOT EXISTS log.user_auth();
|
|
30
|
+
ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS user_auth_id text NOT NULL DEFAULT next_id();
|
|
31
|
+
ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS user_id text;
|
|
32
|
+
ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS auth_date timestamp without time zone;
|
|
33
|
+
ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS auth_type text;
|
|
34
|
+
ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS uid text;
|
|
35
|
+
ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
|
|
36
|
+
ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS editor_id text;
|
|
37
|
+
ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
38
|
+
|
|
39
|
+
COMMENT ON TABLE log.table_changes IS 'Логи подій змін в БД';
|
|
40
|
+
COMMENT ON COLUMN log.table_changes.change_type IS 'Тип події (insert / update / delete)';
|
|
41
|
+
COMMENT ON COLUMN log.table_changes.change_date IS 'Дата внесення змін до БД';
|
|
42
|
+
COMMENT ON COLUMN log.table_changes.entity_type IS 'Таблиця, до якої вносяться зміни';
|
|
43
|
+
COMMENT ON COLUMN log.table_changes.entity_id IS 'ID строки, до якої вносяться зміни';
|
|
44
|
+
COMMENT ON COLUMN log.table_changes.change_user_id IS 'Ініціатор внесення змін';
|
|
45
|
+
|
|
46
|
+
COMMENT ON TABLE log.table_changes_data IS 'Логи змін в таблицях БД';
|
|
47
|
+
COMMENT ON COLUMN log.table_changes_data.change_id IS 'ID події зміни в БД';
|
|
48
|
+
COMMENT ON COLUMN log.table_changes_data.entity_key IS 'Колонка таблиці, до якої вносяться зміни';
|
|
49
|
+
COMMENT ON COLUMN log.table_changes_data.value_old IS 'Старе значення';
|
|
50
|
+
COMMENT ON COLUMN log.table_changes_data.value_new IS 'Нове значення';
|
|
51
|
+
|
|
52
|
+
COMMENT ON TABLE log.user_auth IS 'Логи авторизації';
|
|
53
|
+
COMMENT ON COLUMN log.user_auth.user_id IS 'ID користувача';
|
|
54
|
+
COMMENT ON COLUMN log.user_auth.auth_date IS 'Дата авторизації';
|
|
55
|
+
COMMENT ON COLUMN log.user_auth.auth_type IS 'Тип авторизації';
|
|
56
|
+
|
|
57
|
+
ALTER TABLE log.table_changes DROP CONSTRAINT IF EXISTS log_table_changes_pkey cascade;
|
|
58
|
+
ALTER TABLE log.table_changes_data DROP CONSTRAINT IF EXISTS log_table_changes_data_pkey;
|
|
59
|
+
ALTER TABLE log.table_changes_data DROP CONSTRAINT IF EXISTS log_table_changes_data_change_id_fkey;
|
|
60
|
+
ALTER TABLE log.user_auth DROP CONSTRAINT IF EXISTS log_user_auth_pkey;
|
|
61
|
+
ALTER TABLE log.user_auth DROP CONSTRAINT IF EXISTS log_user_auth_user_id_fkey;
|
|
62
|
+
|
|
63
|
+
ALTER TABLE log.table_changes ADD CONSTRAINT log_table_changes_pkey PRIMARY KEY (change_id);
|
|
64
|
+
ALTER TABLE log.table_changes_data ADD CONSTRAINT log_table_changes_data_pkey PRIMARY KEY (change_data_id);
|
|
65
|
+
ALTER TABLE log.table_changes_data ADD CONSTRAINT log_table_changes_data_change_id_fkey FOREIGN KEY (change_id)
|
|
66
|
+
REFERENCES log.table_changes (change_id);
|
|
67
|
+
ALTER TABLE log.user_auth ADD CONSTRAINT log_user_auth_pkey PRIMARY KEY (user_auth_id);
|
|
68
|
+
-- ALTER TABLE log.user_auth ADD CONSTRAINT log_user_auth_user_id_fkey FOREIGN KEY (user_id) REFERENCES admin.users (uid) MATCH SIMPLE;
|
|
69
|
+
|
|
70
|
+
/* drop old columns */
|
|
71
|
+
alter table log.table_changes drop column if exists date_new;
|
|
72
|
+
alter table log.table_changes drop column if exists date_old;
|
|
73
|
+
alter table log.table_changes drop column if exists number_new;
|
|
74
|
+
alter table log.table_changes drop column if exists number_old;
|
|
75
|
+
alter table log.table_changes drop column if exists json_new;
|
|
76
|
+
alter table log.table_changes drop column if exists json_old;
|
|
77
|
+
alter table log.table_changes drop column if exists text_new;
|
|
78
|
+
alter table log.table_changes drop column if exists text_old;
|
|
79
|
+
alter table log.table_changes drop column if exists bool_new;
|
|
80
|
+
alter table log.table_changes drop column if exists bool_old;
|
|
81
81
|
alter table log.table_changes drop column if exists table_change_id;
|
|
@@ -28,4 +28,31 @@ ALTER TABLE admin.properties ADD COLUMN IF NOT EXISTS files json;
|
|
|
28
28
|
|
|
29
29
|
ALTER TABLE admin.properties ADD CONSTRAINT admin_properties_property_id_pkey PRIMARY KEY(property_id);
|
|
30
30
|
|
|
31
|
-
COMMENT ON TABLE admin.properties IS 'Налаштування';
|
|
31
|
+
COMMENT ON TABLE admin.properties IS 'Налаштування';
|
|
32
|
+
|
|
33
|
+
-- DROP TABLE admin.user_properties;
|
|
34
|
+
CREATE TABLE IF NOT EXISTS admin.user_properties();
|
|
35
|
+
ALTER TABLE admin.user_properties DROP CONSTRAINT IF EXISTS admin_user_properties_property_id_pkey;
|
|
36
|
+
alter table admin.user_properties drop constraint if exists user_properties_key_uid_unique;
|
|
37
|
+
ALTER TABLE admin.user_properties ADD COLUMN IF NOT EXISTS property_id text NOT NULL DEFAULT next_id();
|
|
38
|
+
|
|
39
|
+
ALTER TABLE admin.user_properties ADD COLUMN IF NOT EXISTS property_key text;
|
|
40
|
+
COMMENT ON COLUMN admin.user_properties.property_key IS 'Ключ';
|
|
41
|
+
ALTER TABLE admin.user_properties ADD COLUMN IF NOT EXISTS property_json json;
|
|
42
|
+
COMMENT ON COLUMN admin.user_properties.property_json IS 'Значення налаштування';
|
|
43
|
+
|
|
44
|
+
ALTER TABLE admin.properties ADD COLUMN IF NOT EXISTS property_entity text;
|
|
45
|
+
COMMENT ON COLUMN admin.properties.property_entity IS 'Сутність';
|
|
46
|
+
ALTER TABLE admin.properties ADD COLUMN IF NOT EXISTS property_title text;
|
|
47
|
+
COMMENT ON COLUMN admin.properties.property_title IS 'Назва';
|
|
48
|
+
|
|
49
|
+
ALTER TABLE admin.user_properties ADD COLUMN IF NOT EXISTS uid text NOT NULL DEFAULT '1'::text;
|
|
50
|
+
ALTER TABLE admin.user_properties ADD COLUMN IF NOT EXISTS editor_id text;
|
|
51
|
+
ALTER TABLE admin.user_properties ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
|
|
52
|
+
ALTER TABLE admin.user_properties ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT now();
|
|
53
|
+
ALTER TABLE admin.user_properties ADD COLUMN IF NOT EXISTS files json;
|
|
54
|
+
|
|
55
|
+
ALTER TABLE admin.user_properties ADD CONSTRAINT admin_user_properties_property_id_pkey PRIMARY KEY(property_id);
|
|
56
|
+
alter table admin.user_properties add constraint user_properties_key_uid_unique UNIQUE (property_key,uid);
|
|
57
|
+
|
|
58
|
+
COMMENT ON TABLE admin.user_properties IS 'Налаштування користувача';
|
|
@@ -87,3 +87,48 @@ LANGUAGE plpgsql VOLATILE COST 100;
|
|
|
87
87
|
DROP TRIGGER if exists insert_update_user_before on admin.users;
|
|
88
88
|
CREATE TRIGGER insert_update_user_before BEFORE INSERT OR UPDATE ON admin.users FOR EACH ROW
|
|
89
89
|
EXECUTE PROCEDURE admin.insert_update_user_before();
|
|
90
|
+
|
|
91
|
+
-- DROP TABLE is exists admin.users_social_auth;
|
|
92
|
+
CREATE TABLE if not exists admin.users_social_auth();
|
|
93
|
+
ALTER TABLE admin.users_social_auth add column if not exists users_social_auth_id text NOT NULL DEFAULT next_id();
|
|
94
|
+
ALTER TABLE admin.users_social_auth alter column users_social_auth_id set DEFAULT next_id();
|
|
95
|
+
ALTER TABLE admin.users_social_auth DROP CONSTRAINT if exists users_social_auth_pk cascade;
|
|
96
|
+
ALTER TABLE admin.users_social_auth DROP CONSTRAINT if exists users_social_auth_users_fk cascade;
|
|
97
|
+
|
|
98
|
+
ALTER TABLE admin.users_social_auth add column if not exists uid text not null;
|
|
99
|
+
ALTER TABLE admin.users_social_auth add column if not exists user_name text;
|
|
100
|
+
ALTER TABLE admin.users_social_auth add column if not exists sur_name text;
|
|
101
|
+
ALTER TABLE admin.users_social_auth add column if not exists email text;
|
|
102
|
+
ALTER TABLE admin.users_social_auth add column if not exists city text;
|
|
103
|
+
ALTER TABLE admin.users_social_auth add column if not exists phone text;
|
|
104
|
+
ALTER TABLE admin.users_social_auth add column if not exists social_auth_id text;
|
|
105
|
+
ALTER TABLE admin.users_social_auth add column if not exists social_auth_type text;
|
|
106
|
+
ALTER TABLE admin.users_social_auth add column if not exists social_auth_code text;
|
|
107
|
+
ALTER TABLE admin.users_social_auth add column if not exists social_auth_obj json;
|
|
108
|
+
ALTER TABLE admin.users_social_auth add column if not exists social_auth_date timestamp without time zone;
|
|
109
|
+
ALTER TABLE admin.users_social_auth add column if not exists social_auth_softpro_code text;
|
|
110
|
+
ALTER TABLE admin.users_social_auth add column if not exists enabled boolean;
|
|
111
|
+
ALTER TABLE admin.users_social_auth add column if not exists cdate timestamp without time zone;
|
|
112
|
+
ALTER TABLE admin.users_social_auth alter column cdate SET DEFAULT date_trunc('seconds'::text, now());
|
|
113
|
+
|
|
114
|
+
ALTER TABLE admin.users_social_auth add column if not exists editor_id text;
|
|
115
|
+
ALTER TABLE admin.users_social_auth add column if not exists lang text;
|
|
116
|
+
ALTER TABLE admin.users_social_auth add column if not exists editor_date timestamp without time zone;
|
|
117
|
+
ALTER TABLE admin.users_social_auth add column if not exists social_auth_url text;
|
|
118
|
+
ALTER TABLE admin.users_social_auth add CONSTRAINT users_social_auth_pk PRIMARY KEY (users_social_auth_id);
|
|
119
|
+
ALTER TABLE admin.users_social_auth add CONSTRAINT users_social_auth_users_fk FOREIGN KEY (uid) REFERENCES admin.users (uid) MATCH SIMPLE;
|
|
120
|
+
|
|
121
|
+
COMMENT ON COLUMN admin.users_social_auth.uid IS 'id пользователя';
|
|
122
|
+
COMMENT ON COLUMN admin.users_social_auth.user_name IS 'Имя пользователя';
|
|
123
|
+
COMMENT ON COLUMN admin.users_social_auth.sur_name IS 'Фамилия';
|
|
124
|
+
COMMENT ON COLUMN admin.users_social_auth.email IS 'email пользователя';
|
|
125
|
+
COMMENT ON COLUMN admin.users_social_auth.city IS 'Місто';
|
|
126
|
+
COMMENT ON COLUMN admin.users_social_auth.phone IS 'Телефон';
|
|
127
|
+
COMMENT ON COLUMN admin.users_social_auth.social_auth_id IS 'ID в соцсети';
|
|
128
|
+
COMMENT ON COLUMN admin.users_social_auth.social_auth_type IS 'тип соцсети';
|
|
129
|
+
COMMENT ON COLUMN admin.users_social_auth.social_auth_code IS 'код обьекта соцсети, используеться соцсетью';
|
|
130
|
+
COMMENT ON COLUMN admin.users_social_auth.social_auth_obj IS 'обьект соцсети';
|
|
131
|
+
COMMENT ON COLUMN admin.users_social_auth.social_auth_date IS 'время получение последнего обьекта соцсети';
|
|
132
|
+
COMMENT ON COLUMN admin.users_social_auth.social_auth_softpro_code IS 'код обьекта соцсети, создаваемый и используемый сервером авторизации';
|
|
133
|
+
COMMENT ON COLUMN admin.users_social_auth.enabled IS 'Выключатель';
|
|
134
|
+
COMMENT ON COLUMN admin.users_social_auth.social_auth_url IS 'URL для QR code';
|
package/server.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
// This file contains code that we reuse
|
|
2
|
-
// between our tests.
|
|
3
|
-
import Fastify from 'fastify';
|
|
4
|
-
import config from './test/config.js';
|
|
5
|
-
import appService from './index.js';
|
|
6
|
-
|
|
7
|
-
const app = Fastify({ logger: false });
|
|
8
|
-
app.register(appService, config);
|
|
9
|
-
app.listen({ host: '0.0.0.0', port: process.env.PORT || 3000 }, (err) => {
|
|
10
|
-
if (err) {
|
|
11
|
-
app.log.error(err);
|
|
12
|
-
process.exit(1);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
1
|
+
// This file contains code that we reuse
|
|
2
|
+
// between our tests.
|
|
3
|
+
import Fastify from 'fastify';
|
|
4
|
+
import config from './test/config.js';
|
|
5
|
+
import appService from './index.js';
|
|
6
|
+
|
|
7
|
+
const app = Fastify({ logger: false });
|
|
8
|
+
app.register(appService, config);
|
|
9
|
+
app.listen({ host: '0.0.0.0', port: process.env.PORT || 3000 }, (err) => {
|
|
10
|
+
if (err) {
|
|
11
|
+
app.log.error(err);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
});
|