@opengis/fastify-table 1.0.34 → 1.0.36

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.
Files changed (77) hide show
  1. package/.eslintrc.cjs +42 -42
  2. package/Changelog.md +105 -101
  3. package/README.md +26 -26
  4. package/config.js +12 -12
  5. package/crud/controllers/deleteCrud.js +14 -14
  6. package/crud/controllers/insert.js +29 -29
  7. package/crud/controllers/update.js +31 -31
  8. package/crud/controllers/utils/checkXSS.js +45 -45
  9. package/crud/controllers/utils/xssInjection.js +72 -72
  10. package/crud/funcs/dataDelete.js +15 -15
  11. package/crud/funcs/dataInsert.js +24 -24
  12. package/crud/funcs/dataUpdate.js +24 -24
  13. package/crud/funcs/getOpt.js +10 -10
  14. package/crud/funcs/getToken.js +27 -27
  15. package/crud/funcs/isFileExists.js +13 -13
  16. package/crud/funcs/setOpt.js +16 -16
  17. package/crud/funcs/setToken.js +53 -53
  18. package/crud/index.js +29 -29
  19. package/helper.js +28 -28
  20. package/index.js +39 -39
  21. package/notification/controllers/userNotifications.js +19 -19
  22. package/notification/funcs/addNotification.js +8 -8
  23. package/notification/index.js +19 -19
  24. package/package.json +22 -22
  25. package/pg/funcs/getPG.js +29 -29
  26. package/pg/pgClients.js +20 -20
  27. package/policy/funcs/checkPolicy.js +74 -74
  28. package/policy/funcs/sqlInjection.js +33 -33
  29. package/policy/index.js +14 -14
  30. package/redis/client.js +8 -8
  31. package/redis/funcs/getRedis.js +23 -23
  32. package/redis/funcs/redisClients.js +2 -2
  33. package/redis/index.js +19 -19
  34. package/server/migrations/crm.sql +95 -95
  35. package/server/migrations/log.sql +41 -41
  36. package/server/templates/form/test.dataset.form.json +411 -411
  37. package/server/templates/select/test.storage.data.json +2 -2
  38. package/server/templates/table/test.dataset.table.json +24 -24
  39. package/server.js +14 -14
  40. package/table/controllers/data.js +57 -57
  41. package/table/controllers/filter.js +37 -32
  42. package/table/controllers/form.js +10 -10
  43. package/table/controllers/search.js +41 -41
  44. package/table/controllers/suggest.js +60 -60
  45. package/table/controllers/utils/getSelect.js +20 -20
  46. package/table/controllers/utils/getSelectMeta.js +66 -66
  47. package/table/controllers/utils/getTemplate.js +28 -28
  48. package/table/funcs/getFilterSQL/index.js +75 -75
  49. package/table/funcs/getFilterSQL/util/formatValue.js +142 -142
  50. package/table/funcs/getFilterSQL/util/getCustomQuery.js +13 -13
  51. package/table/funcs/getFilterSQL/util/getFilterQuery.js +73 -73
  52. package/table/funcs/getFilterSQL/util/getOptimizedQuery.js +12 -12
  53. package/table/funcs/getFilterSQL/util/getTableSql.js +34 -34
  54. package/table/funcs/metaFormat/getSelectVal.js +20 -20
  55. package/table/funcs/metaFormat/index.js +26 -26
  56. package/table/index.js +42 -42
  57. package/test/api/crud.test.js +56 -56
  58. package/test/api/crud.xss.test.js +71 -71
  59. package/test/api/notification.test.js +37 -37
  60. package/test/api/table.test.js +57 -57
  61. package/test/api/widget.test.js +114 -114
  62. package/test/config.example +18 -18
  63. package/test/funcs/crud.test.js +76 -76
  64. package/test/funcs/notification.test.js +31 -31
  65. package/test/funcs/pg.test.js +34 -34
  66. package/test/funcs/redis.test.js +19 -19
  67. package/test/templates/cls/test.json +9 -9
  68. package/test/templates/form/cp_building.form.json +32 -32
  69. package/test/templates/select/account_id.json +3 -3
  70. package/test/templates/select/storage.data.json +2 -2
  71. package/test/templates/table/gis.dataset.table.json +20 -20
  72. package/widget/controllers/utils/historyFormat.js +76 -76
  73. package/widget/controllers/utils/obj2db.js +13 -13
  74. package/widget/controllers/widget.del.js +41 -41
  75. package/widget/controllers/widget.get.js +77 -77
  76. package/widget/controllers/widget.set.js +64 -64
  77. package/widget/index.js +29 -29
package/redis/index.js CHANGED
@@ -1,19 +1,19 @@
1
- // import client from './client.js';
2
- import getRedis from './funcs/getRedis.js';
3
- // import client from './funcs/redisClients.js';
4
-
5
- function close(fastify) {
6
- fastify.rclient.quit();
7
- // fastify.rclient2.quit();
8
- }
9
-
10
- async function plugin(fastify) {
11
- const client = getRedis({ db: 0, funcs: fastify });
12
- client.getJSON = client.get;
13
- fastify.decorate('rclient', client);
14
- fastify.decorate('getRedis', getRedis);
15
- // fastify.decorate('rclient2', client2);
16
- fastify.addHook('onClose', close);
17
- }
18
-
19
- export default plugin;
1
+ // import client from './client.js';
2
+ import getRedis from './funcs/getRedis.js';
3
+ // import client from './funcs/redisClients.js';
4
+
5
+ function close(fastify) {
6
+ fastify.rclient.quit();
7
+ // fastify.rclient2.quit();
8
+ }
9
+
10
+ async function plugin(fastify) {
11
+ const client = getRedis({ db: 0, funcs: fastify });
12
+ client.getJSON = client.get;
13
+ fastify.decorate('rclient', client);
14
+ fastify.decorate('getRedis', getRedis);
15
+ // fastify.decorate('rclient2', client2);
16
+ fastify.addHook('onClose', close);
17
+ }
18
+
19
+ export default plugin;
@@ -1,95 +1,95 @@
1
- -- crm.notifications
2
- -- DROP TABLE IF EXISTS crm.notifications;
3
- CREATE TABLE IF NOT EXISTS crm.notifications();
4
- ALTER TABLE crm.notifications DROP CONSTRAINT IF EXISTS crm_notifications_pkey;
5
- ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS notification_id text NOT NULL DEFAULT admin.next_id();
6
-
7
- ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS notification_user_id text;
8
- ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS notification_type text DEFAULT 'notify'::text;
9
- ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS notification_status text DEFAULT 'not sent'::text;
10
- ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS subject text;
11
- ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS body text;
12
- ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS link text;
13
-
14
- ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS uid text;
15
- ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS files json;
16
- ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
17
- ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS editor_id text;
18
- ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
19
- ALTER TABLE crm.notifications ADD CONSTRAINT crm_notifications_pkey PRIMARY KEY (notification_id);
20
-
21
- -- crm.files
22
- -- DROP TABLE IF EXISTS crm.files;
23
- CREATE TABLE IF NOT EXISTS crm.files();
24
- ALTER TABLE crm.files DROP CONSTRAINT IF EXISTS crm_files_pkey;
25
- ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS file_id text NOT NULL DEFAULT admin.next_id();
26
-
27
- ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS uploaded_name text;
28
- ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS entity_id text; -- object_id
29
- ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS entity_type text; -- table_name
30
- ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS file_type text;
31
- ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS file_status numeric;
32
- ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS doc_type text;
33
- ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS subject text; -- title
34
- ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS size numeric;
35
- ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS ext text;
36
- ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS tags text[];
37
- ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS file_path text;
38
- ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS ismain boolean default false;
39
- ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS isverified boolean default false;
40
- ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS uid text;
41
- ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS files json;
42
- ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
43
- ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS editor_id text;
44
- ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
45
- ALTER TABLE crm.files ADD CONSTRAINT crm_files_pkey PRIMARY KEY (file_id);
46
-
47
- -- crm.communications
48
- -- DROP TABLE IF EXISTS crm.communications;
49
- CREATE TABLE IF NOT EXISTS crm.communications();
50
- ALTER TABLE crm.communications DROP CONSTRAINT IF EXISTS crm_communications_pkey;
51
- ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS communication_id text NOT NULL DEFAULT admin.next_id();
52
-
53
- ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS entity_id text; -- object_id
54
- ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS entity_type text; -- table_name
55
- ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS sender text;
56
- ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS channel text;
57
- ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS participant text;
58
- ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS communication_date date;
59
- ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS expiration_date date;
60
- ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS announcement text;
61
- ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS subject text; -- title
62
- ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS body text;
63
- ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS mark numeric;
64
- ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS parent_id text;
65
- ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS target_id text[];
66
- ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS enabled boolean;
67
- ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS uid text;
68
- ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS files json;
69
- ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
70
- ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS editor_id text;
71
- ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
72
- ALTER TABLE crm.communications ADD CONSTRAINT crm_communications_pkey PRIMARY KEY (communication_id);
73
-
74
- -- crm.checklists
75
- -- DROP TABLE IF EXISTS crm.checklists;
76
- CREATE TABLE IF NOT EXISTS crm.checklists();
77
- ALTER TABLE crm.checklists DROP CONSTRAINT IF EXISTS checklists_pkey;
78
- ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS checklist_id text NOT NULL DEFAULT admin.next_id();
79
-
80
- ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS entity_id text; -- object_id
81
- ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS entity_type text; -- table_name
82
- ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS subject text; -- title
83
- alter table crm.checklists add column IF NOT EXISTS is_done boolean default false;
84
- alter table crm.checklists add column IF NOT EXISTS done_date date;
85
- alter table crm.checklists add column IF NOT EXISTS category text;
86
- alter table crm.checklists add column IF NOT EXISTS body text;
87
- alter table crm.checklists add column IF NOT EXISTS parent_id text;
88
- alter table crm.checklists add column IF NOT EXISTS flag boolean;
89
-
90
- ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS uid text;
91
- ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS files json;
92
- ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
93
- ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS editor_id text;
94
- ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
95
- ALTER TABLE crm.checklists ADD CONSTRAINT crm_checklists_pkey PRIMARY KEY (checklist_id);
1
+ -- crm.notifications
2
+ -- DROP TABLE IF EXISTS crm.notifications;
3
+ CREATE TABLE IF NOT EXISTS crm.notifications();
4
+ ALTER TABLE crm.notifications DROP CONSTRAINT IF EXISTS crm_notifications_pkey;
5
+ ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS notification_id text NOT NULL DEFAULT admin.next_id();
6
+
7
+ ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS notification_user_id text;
8
+ ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS notification_type text DEFAULT 'notify'::text;
9
+ ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS notification_status text DEFAULT 'not sent'::text;
10
+ ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS subject text;
11
+ ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS body text;
12
+ ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS link text;
13
+
14
+ ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS uid text;
15
+ ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS files json;
16
+ ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
17
+ ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS editor_id text;
18
+ ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
19
+ ALTER TABLE crm.notifications ADD CONSTRAINT crm_notifications_pkey PRIMARY KEY (notification_id);
20
+
21
+ -- crm.files
22
+ -- DROP TABLE IF EXISTS crm.files;
23
+ CREATE TABLE IF NOT EXISTS crm.files();
24
+ ALTER TABLE crm.files DROP CONSTRAINT IF EXISTS crm_files_pkey;
25
+ ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS file_id text NOT NULL DEFAULT admin.next_id();
26
+
27
+ ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS uploaded_name text;
28
+ ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS entity_id text; -- object_id
29
+ ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS entity_type text; -- table_name
30
+ ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS file_type text;
31
+ ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS file_status numeric;
32
+ ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS doc_type text;
33
+ ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS subject text; -- title
34
+ ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS size numeric;
35
+ ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS ext text;
36
+ ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS tags text[];
37
+ ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS file_path text;
38
+ ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS ismain boolean default false;
39
+ ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS isverified boolean default false;
40
+ ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS uid text;
41
+ ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS files json;
42
+ ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
43
+ ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS editor_id text;
44
+ ALTER TABLE crm.files ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
45
+ ALTER TABLE crm.files ADD CONSTRAINT crm_files_pkey PRIMARY KEY (file_id);
46
+
47
+ -- crm.communications
48
+ -- DROP TABLE IF EXISTS crm.communications;
49
+ CREATE TABLE IF NOT EXISTS crm.communications();
50
+ ALTER TABLE crm.communications DROP CONSTRAINT IF EXISTS crm_communications_pkey;
51
+ ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS communication_id text NOT NULL DEFAULT admin.next_id();
52
+
53
+ ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS entity_id text; -- object_id
54
+ ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS entity_type text; -- table_name
55
+ ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS sender text;
56
+ ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS channel text;
57
+ ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS participant text;
58
+ ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS communication_date date;
59
+ ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS expiration_date date;
60
+ ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS announcement text;
61
+ ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS subject text; -- title
62
+ ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS body text;
63
+ ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS mark numeric;
64
+ ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS parent_id text;
65
+ ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS target_id text[];
66
+ ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS enabled boolean;
67
+ ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS uid text;
68
+ ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS files json;
69
+ ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
70
+ ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS editor_id text;
71
+ ALTER TABLE crm.communications ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
72
+ ALTER TABLE crm.communications ADD CONSTRAINT crm_communications_pkey PRIMARY KEY (communication_id);
73
+
74
+ -- crm.checklists
75
+ -- DROP TABLE IF EXISTS crm.checklists;
76
+ CREATE TABLE IF NOT EXISTS crm.checklists();
77
+ ALTER TABLE crm.checklists DROP CONSTRAINT IF EXISTS checklists_pkey;
78
+ ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS checklist_id text NOT NULL DEFAULT admin.next_id();
79
+
80
+ ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS entity_id text; -- object_id
81
+ ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS entity_type text; -- table_name
82
+ ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS subject text; -- title
83
+ alter table crm.checklists add column IF NOT EXISTS is_done boolean default false;
84
+ alter table crm.checklists add column IF NOT EXISTS done_date date;
85
+ alter table crm.checklists add column IF NOT EXISTS category text;
86
+ alter table crm.checklists add column IF NOT EXISTS body text;
87
+ alter table crm.checklists add column IF NOT EXISTS parent_id text;
88
+ alter table crm.checklists add column IF NOT EXISTS flag boolean;
89
+
90
+ ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS uid text;
91
+ ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS files json;
92
+ ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
93
+ ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS editor_id text;
94
+ ALTER TABLE crm.checklists ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
95
+ ALTER TABLE crm.checklists ADD CONSTRAINT crm_checklists_pkey PRIMARY KEY (checklist_id);
@@ -1,42 +1,42 @@
1
- CREATE TABLE IF NOT EXISTS log.table_changes();
2
- ALTER TABLE log.table_changes DROP CONSTRAINT IF EXISTS log_table_changes_pkey;
3
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS table_change_id text NOT NULL DEFAULT admin.next_id();
4
-
5
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS entity_type text;
6
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS entity_id text; -- object_id
7
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_type text;
8
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_key text;
9
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_date date;
10
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS json_old json;
11
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS json_new json;
12
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS date_old timestamp without time zone;
13
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS date_new timestamp without time zone;
14
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS number_old numeric;
15
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS number_new numeric;
16
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS bool_old boolean;
17
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS bool_new boolean;
18
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS text_old text;
19
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS text_new text;
20
-
21
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS uid text;
22
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
23
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS editor_id text;
24
- ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
25
- ALTER TABLE log.table_changes ADD CONSTRAINT log_table_changes_pkey PRIMARY KEY (table_change_id);
26
-
27
- CREATE TABLE IF NOT EXISTS log.user_auth();
28
- ALTER TABLE log.user_auth DROP CONSTRAINT IF EXISTS log_user_auth_pkey;
29
- ALTER TABLE log.user_auth DROP CONSTRAINT IF EXISTS log_user_auth_user_id_fkey;
30
-
31
- ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS user_auth_id text NOT NULL DEFAULT admin.next_id();
32
-
33
- ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS user_id text;
34
- ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS user_auth_date timestamp without time zone;
35
- ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS user_auth_type text;
36
-
37
- ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS uid text;
38
- ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
39
- ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS editor_id text;
40
- ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
41
- ALTER TABLE log.user_auth ADD CONSTRAINT log_user_auth_pkey PRIMARY KEY (user_auth_id);
1
+ CREATE TABLE IF NOT EXISTS log.table_changes();
2
+ ALTER TABLE log.table_changes DROP CONSTRAINT IF EXISTS log_table_changes_pkey;
3
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS table_change_id text NOT NULL DEFAULT admin.next_id();
4
+
5
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS entity_type text;
6
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS entity_id text; -- object_id
7
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_type text;
8
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_key text;
9
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS change_date date;
10
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS json_old json;
11
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS json_new json;
12
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS date_old timestamp without time zone;
13
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS date_new timestamp without time zone;
14
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS number_old numeric;
15
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS number_new numeric;
16
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS bool_old boolean;
17
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS bool_new boolean;
18
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS text_old text;
19
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS text_new text;
20
+
21
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS uid text;
22
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
23
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS editor_id text;
24
+ ALTER TABLE log.table_changes ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
25
+ ALTER TABLE log.table_changes ADD CONSTRAINT log_table_changes_pkey PRIMARY KEY (table_change_id);
26
+
27
+ CREATE TABLE IF NOT EXISTS log.user_auth();
28
+ ALTER TABLE log.user_auth DROP CONSTRAINT IF EXISTS log_user_auth_pkey;
29
+ ALTER TABLE log.user_auth DROP CONSTRAINT IF EXISTS log_user_auth_user_id_fkey;
30
+
31
+ ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS user_auth_id text NOT NULL DEFAULT admin.next_id();
32
+
33
+ ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS user_id text;
34
+ ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS user_auth_date timestamp without time zone;
35
+ ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS user_auth_type text;
36
+
37
+ ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS uid text;
38
+ ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
39
+ ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS editor_id text;
40
+ ALTER TABLE log.user_auth ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
41
+ ALTER TABLE log.user_auth ADD CONSTRAINT log_user_auth_pkey PRIMARY KEY (user_auth_id);
42
42
  ALTER TABLE log.user_auth ADD CONSTRAINT log_user_auth_user_id_fkey FOREIGN KEY (user_id) REFERENCES admin.users (uid) MATCH SIMPLE;