@opengis/fastify-table 2.4.2 → 2.4.3
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/README.md +86 -86
- package/dist/functions.js +20 -20
- package/dist/module/core/cls/constraint_action.json +9 -9
- package/dist/module/core/cls/constraint_matchtype.json +5 -5
- package/dist/module/core/cls/constraint_type_full.json +17 -17
- package/dist/module/core/cls/core.user_type.json +13 -13
- package/dist/module/core/pt/schemaItem.pt.hbs +17 -17
- package/dist/script/adduser +14 -14
- package/dist/script/dump.js +48 -48
- package/dist/script/dump.ts +216 -216
- package/dist/script/migrate.ts +41 -41
- package/dist/server/helpers/core/badge.js +1 -1
- package/dist/server/helpers/list/descriptionList.js +8 -8
- package/dist/server/helpers/list/tableList.js +4 -4
- package/dist/server/helpers/list/utils/button.js +1 -1
- package/dist/server/helpers/list/utils/buttonDel.js +3 -3
- package/dist/server/helpers/list/utils/buttonEdit.js +3 -3
- package/dist/server/helpers/utils/button.js +1 -1
- package/dist/server/helpers/utils/buttonAdd.js +15 -15
- package/dist/server/helpers/utils/buttonDel.js +11 -11
- package/dist/server/helpers/utils/buttonEdit.js +3 -3
- package/dist/server/migrations/0.sql +99 -99
- package/dist/server/migrations/cls.sql +105 -105
- package/dist/server/migrations/context.sql +136 -136
- package/dist/server/migrations/oauth.sql +79 -79
- package/dist/server/migrations/properties.sql +115 -115
- package/dist/server/migrations/roles.sql +195 -195
- package/dist/server/migrations/template.sql +43 -43
- package/dist/server/migrations/users.sql +151 -151
- package/dist/server/plugins/access/funcs/getUserPermissions.js +7 -7
- package/dist/server/plugins/auth/funcs/authorizeUser.js +4 -4
- package/dist/server/plugins/auth/funcs/getQuery.js +20 -20
- package/dist/server/plugins/crud/funcs/dataUpdate.js +7 -7
- package/dist/server/plugins/crud/funcs/getAccess.js +14 -14
- package/dist/server/plugins/crud/funcs/utils/getInsertQuery.js +6 -6
- package/dist/server/plugins/crud/funcs/utils/logChanges.js +18 -18
- package/dist/server/plugins/grpc/utils/convertp.proto +136 -136
- package/dist/server/plugins/grpc/utils/htmlTemplate.js +10 -10
- package/dist/server/plugins/grpc/utils/office2pdf.proto +13 -13
- package/dist/server/plugins/metric/loggerSystem.js +1 -1
- package/dist/server/plugins/pg/funcs/autoIndex.js +5 -5
- package/dist/server/plugins/pg/funcs/getMeta.js +10 -10
- package/dist/server/plugins/pg/funcs/init.js +36 -36
- package/dist/server/plugins/sqlite/funcs/init.js +22 -22
- package/dist/server/plugins/table/funcs/getFilterSQL/util/getCustomQuery.js +1 -1
- package/dist/server/plugins/table/funcs/getSelect.js +1 -1
- package/dist/server/plugins/table/funcs/gisIRColumn.js +3 -3
- package/dist/server/plugins/usercls/index.js +2 -2
- package/dist/server/routes/access/controllers/access.group.js +6 -6
- package/dist/server/routes/access/controllers/access.group.post.js +5 -5
- package/dist/server/routes/access/controllers/access.interface.js +14 -14
- package/dist/server/routes/access/controllers/access.user.js +6 -6
- package/dist/server/routes/auth/controllers/2factor/providers/totp.js +5 -5
- package/dist/server/routes/auth/controllers/2factor/qrcode.js +1 -1
- package/dist/server/routes/auth/controllers/2factor/recovery.js +1 -1
- package/dist/server/routes/auth/controllers/2factor/verify.js +1 -1
- package/dist/server/routes/auth/controllers/core/getUserInfo.js +33 -33
- package/dist/server/routes/auth/controllers/core/passwordRecovery.js +1 -1
- package/dist/server/routes/auth/controllers/core/registration.js +2 -2
- package/dist/server/routes/auth/controllers/page/login2faTemplate.js +1 -1
- package/dist/server/routes/file/controllers/download.d.ts.map +1 -1
- package/dist/server/routes/file/controllers/download.js +1 -1
- package/dist/server/routes/file/controllers/files.d.ts.map +1 -1
- package/dist/server/routes/file/controllers/files.js +1 -1
- package/dist/server/routes/file/controllers/resizeAll.js +6 -6
- package/dist/server/routes/grpc/controllers/file2geojson.js +13 -13
- package/dist/server/routes/menu/controllers/getMenu.js +9 -9
- package/dist/server/routes/notifications/controllers/readNotifications.js +4 -4
- package/dist/server/routes/notifications/controllers/userNotifications.js +3 -3
- package/dist/server/routes/table/controllers/card.js +1 -1
- package/dist/server/routes/table/controllers/filter.js +6 -6
- package/dist/server/routes/table/controllers/form.js +1 -1
- package/dist/server/routes/table/controllers/getFormByTable.js +6 -6
- package/dist/server/routes/table/controllers/suggest.js +3 -3
- package/dist/server/routes/table/controllers/tableData.js +2 -2
- package/dist/server/routes/table/controllers/tableInfo.js +10 -10
- package/dist/server/routes/table/functions/getData.js +13 -13
- package/dist/server/routes/widget/controllers/widget.get.js +33 -33
- package/dist/server/routes/widget/controllers/widget.set.js +3 -3
- package/dist/server/templates/page/2factor-recovery.html +101 -101
- package/dist/server/templates/page/2factor.html +140 -140
- package/dist/server/templates/page/login.html +90 -90
- package/dist/server/templates/page/loginEuSign.html +123 -123
- package/dist/server/templates/pt/recovery-codes-email-template.hbs +12 -12
- package/dist/server/templates/pt/recovery-password-email-template.html +20 -20
- package/package.json +98 -98
|
@@ -1,137 +1,137 @@
|
|
|
1
|
-
CREATE SCHEMA IF NOT EXISTS admin;
|
|
2
|
-
|
|
3
|
-
CREATE TABLE IF NOT EXISTS admin.rules();
|
|
4
|
-
CREATE TABLE IF NOT EXISTS admin.users( uid text not null constraint admin_user_uid_pkey PRIMARY KEY DEFAULT next_id() );
|
|
5
|
-
ALTER TABLE admin.rules DROP CONSTRAINT IF EXISTS admin_rules_pkey cascade;
|
|
6
|
-
ALTER TABLE admin.rules add column if not exists rule_id text NOT NULL DEFAULT next_id();
|
|
7
|
-
|
|
8
|
-
ALTER TABLE admin.rules add column if not exists rule_type text;
|
|
9
|
-
ALTER TABLE admin.rules add column if not exists rule_name text;
|
|
10
|
-
ALTER TABLE admin.rules add column if not exists attr text;
|
|
11
|
-
ALTER TABLE admin.rules add column if not exists routes text[];
|
|
12
|
-
ALTER TABLE admin.rules add column if not exists uid text;
|
|
13
|
-
ALTER TABLE admin.rules add column if not exists cdate timestamp without time zone;
|
|
14
|
-
ALTER TABLE admin.rules add column if not exists rule_query text;
|
|
15
|
-
ALTER TABLE admin.rules add column if not exists cls text;
|
|
16
|
-
COMMENT ON TABLE admin.rules IS 'Повноваження';
|
|
17
|
-
COMMENT ON COLUMN admin.rules.rule_type IS 'Тип повноваження';
|
|
18
|
-
COMMENT ON COLUMN admin.rules.rule_name IS 'Назва';
|
|
19
|
-
COMMENT ON COLUMN admin.rules.attr IS 'Атрибут';
|
|
20
|
-
COMMENT ON COLUMN admin.rules.routes IS 'Роути';
|
|
21
|
-
COMMENT ON COLUMN admin.rules.uid IS 'Хто створив';
|
|
22
|
-
COMMENT ON COLUMN admin.rules.cdate IS 'Дата створення';
|
|
23
|
-
COMMENT ON COLUMN admin.rules.rule_query IS 'Запит';
|
|
24
|
-
COMMENT ON COLUMN admin.rules.cls IS 'Класифікатор';
|
|
25
|
-
ALTER TABLE admin.rules ALTER COLUMN attr DROP NOT NULL;
|
|
26
|
-
ALTER TABLE admin.rules ALTER COLUMN cdate DROP NOT NULL;ALTER TABLE admin.rules ALTER COLUMN cdate SET DEFAULT (now())::timestamp without time zone;
|
|
27
|
-
ALTER TABLE admin.rules ALTER COLUMN cls DROP NOT NULL;
|
|
28
|
-
ALTER TABLE admin.rules ALTER COLUMN routes DROP NOT NULL;
|
|
29
|
-
ALTER TABLE admin.rules ALTER COLUMN rule_id SET NOT NULL;ALTER TABLE admin.rules ALTER COLUMN rule_id SET DEFAULT next_id();
|
|
30
|
-
ALTER TABLE admin.rules ALTER COLUMN rule_name DROP NOT NULL;
|
|
31
|
-
ALTER TABLE admin.rules ALTER COLUMN rule_query DROP NOT NULL;
|
|
32
|
-
ALTER TABLE admin.rules ALTER COLUMN rule_type DROP NOT NULL;
|
|
33
|
-
ALTER TABLE admin.rules ALTER COLUMN uid DROP NOT NULL;
|
|
34
|
-
ALTER TABLE admin.rules add CONSTRAINT admin_rules_pkey PRIMARY KEY (rule_id);
|
|
35
|
-
|
|
36
|
-
CREATE INDEX if not exists admin_rules_id_idx ON admin.rules USING btree (rule_id COLLATE pg_catalog."default");
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
CREATE TABLE IF NOT EXISTS admin.accounts();
|
|
40
|
-
ALTER TABLE admin.accounts DROP CONSTRAINT IF EXISTS admin_accounts_pkey cascade;
|
|
41
|
-
ALTER TABLE admin.accounts add column if not exists account_id text NOT NULL DEFAULT next_id();
|
|
42
|
-
|
|
43
|
-
ALTER TABLE admin.accounts add column if not exists account_name text;
|
|
44
|
-
ALTER TABLE admin.accounts add column if not exists description text;
|
|
45
|
-
ALTER TABLE admin.accounts add column if not exists uid text;
|
|
46
|
-
ALTER TABLE admin.accounts add column if not exists cdate timestamp without time zone;
|
|
47
|
-
COMMENT ON TABLE admin.accounts IS 'Організації';
|
|
48
|
-
COMMENT ON COLUMN admin.accounts.account_name IS 'Назва';
|
|
49
|
-
COMMENT ON COLUMN admin.accounts.description IS 'Опис';
|
|
50
|
-
COMMENT ON COLUMN admin.accounts.uid IS 'Хто створив';
|
|
51
|
-
COMMENT ON COLUMN admin.accounts.cdate IS 'Дата створення';
|
|
52
|
-
ALTER TABLE admin.accounts ALTER COLUMN account_id SET NOT NULL;ALTER TABLE admin.accounts ALTER COLUMN account_id SET DEFAULT next_id();
|
|
53
|
-
ALTER TABLE admin.accounts ALTER COLUMN account_name DROP NOT NULL;
|
|
54
|
-
ALTER TABLE admin.accounts ALTER COLUMN cdate DROP NOT NULL;ALTER TABLE admin.accounts ALTER COLUMN cdate SET DEFAULT (now())::timestamp without time zone;
|
|
55
|
-
ALTER TABLE admin.accounts ALTER COLUMN description DROP NOT NULL;
|
|
56
|
-
ALTER TABLE admin.accounts ALTER COLUMN uid DROP NOT NULL;
|
|
57
|
-
ALTER TABLE admin.accounts add CONSTRAINT admin_accounts_pkey PRIMARY KEY (account_id);
|
|
58
|
-
|
|
59
|
-
CREATE INDEX if not exists admin_accounts_id_idx ON admin.accounts USING btree (account_id COLLATE pg_catalog."default");
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
/*
|
|
63
|
-
CREATE TABLE IF NOT EXISTS admin.account_users();
|
|
64
|
-
ALTER TABLE admin.account_users DROP CONSTRAINT IF EXISTS admin_account_users_pkey;
|
|
65
|
-
ALTER TABLE admin.account_users DROP CONSTRAINT IF EXISTS admin_au_account_fkey;
|
|
66
|
-
ALTER TABLE admin.account_users DROP CONSTRAINT IF EXISTS admin_au_user_fkey;
|
|
67
|
-
ALTER TABLE admin.account_users add column if not exists au_id text NOT NULL DEFAULT next_id();
|
|
68
|
-
|
|
69
|
-
ALTER TABLE admin.account_users add column if not exists account_id text;
|
|
70
|
-
ALTER TABLE admin.account_users add column if not exists user_uid text;
|
|
71
|
-
ALTER TABLE admin.account_users add column if not exists uid text;
|
|
72
|
-
ALTER TABLE admin.account_users add column if not exists cdate timestamp without time zone;
|
|
73
|
-
COMMENT ON TABLE admin.account_users IS 'Організації - Користувачі';
|
|
74
|
-
COMMENT ON COLUMN admin.account_users.account_id IS 'id Організації';
|
|
75
|
-
COMMENT ON COLUMN admin.account_users.user_uid IS 'id Користувача';
|
|
76
|
-
COMMENT ON COLUMN admin.account_users.uid IS 'Хто створив';
|
|
77
|
-
COMMENT ON COLUMN admin.account_users.cdate IS 'Дата створення';
|
|
78
|
-
ALTER TABLE admin.account_users ALTER COLUMN account_id DROP NOT NULL;
|
|
79
|
-
ALTER TABLE admin.account_users ALTER COLUMN au_id SET NOT NULL;ALTER TABLE admin.account_users ALTER COLUMN au_id SET DEFAULT next_id();
|
|
80
|
-
ALTER TABLE admin.account_users ALTER COLUMN cdate DROP NOT NULL;ALTER TABLE admin.account_users ALTER COLUMN cdate SET DEFAULT (now())::timestamp without time zone;
|
|
81
|
-
ALTER TABLE admin.account_users ALTER COLUMN uid DROP NOT NULL;
|
|
82
|
-
ALTER TABLE admin.account_users ALTER COLUMN user_uid DROP NOT NULL;
|
|
83
|
-
ALTER TABLE admin.account_users add CONSTRAINT admin_account_users_pkey PRIMARY KEY (au_id);
|
|
84
|
-
ALTER TABLE admin.account_users ADD CONSTRAINT admin_au_account_fkey FOREIGN KEY (account_id) REFERENCES admin.accounts (account_id) MATCH SIMPLE;
|
|
85
|
-
ALTER TABLE admin.account_users ADD CONSTRAINT admin_au_user_fkey FOREIGN KEY (user_uid) REFERENCES admin.users (uid) MATCH SIMPLE;
|
|
86
|
-
|
|
87
|
-
CREATE INDEX if not exists admin_account_users_id_idx ON admin.account_users USING btree (au_id COLLATE pg_catalog."default");
|
|
88
|
-
CREATE INDEX if not exists admin_au_account_id_idx ON admin.account_users USING btree (account_id COLLATE pg_catalog."default");
|
|
89
|
-
CREATE INDEX if not exists admin_au_user_uid_idx ON admin.account_users USING btree (user_uid COLLATE pg_catalog."default");
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
CREATE TABLE IF NOT EXISTS admin.account_grants();
|
|
93
|
-
ALTER TABLE admin.account_grants DROP CONSTRAINT IF EXISTS admin_account_grants_pkey;
|
|
94
|
-
ALTER TABLE admin.account_grants DROP CONSTRAINT IF EXISTS admin_ag_account_fkey;
|
|
95
|
-
ALTER TABLE admin.account_grants DROP CONSTRAINT IF EXISTS admin_ag_user_fkey;
|
|
96
|
-
ALTER TABLE admin.account_grants add column if not exists ag_id text NOT NULL DEFAULT next_id();
|
|
97
|
-
|
|
98
|
-
ALTER TABLE admin.account_grants add column if not exists account_id text;
|
|
99
|
-
ALTER TABLE admin.account_grants add column if not exists rule_id text;
|
|
100
|
-
ALTER TABLE admin.account_grants add column if not exists routes text[];
|
|
101
|
-
ALTER TABLE admin.account_grants add column if not exists rule_values text[];
|
|
102
|
-
ALTER TABLE admin.account_grants add column if not exists grants_doc_id text;
|
|
103
|
-
ALTER TABLE admin.account_grants add column if not exists grant_scan text;
|
|
104
|
-
ALTER TABLE admin.account_grants add column if not exists expire_date date;
|
|
105
|
-
ALTER TABLE admin.account_grants add column if not exists actions text[];
|
|
106
|
-
ALTER TABLE admin.account_grants add column if not exists uid text;
|
|
107
|
-
ALTER TABLE admin.account_grants add column if not exists cdate timestamp without time zone;
|
|
108
|
-
COMMENT ON TABLE admin.account_grants IS 'Організації - Повноваження';
|
|
109
|
-
COMMENT ON COLUMN admin.account_grants.account_id IS 'id Організації';
|
|
110
|
-
COMMENT ON COLUMN admin.account_grants.rule_id IS 'id Правила';
|
|
111
|
-
COMMENT ON COLUMN admin.account_grants.routes IS 'Роути';
|
|
112
|
-
COMMENT ON COLUMN admin.account_grants.rule_values IS 'Значення';
|
|
113
|
-
COMMENT ON COLUMN admin.account_grants.grants_doc_id IS 'id Документу';
|
|
114
|
-
COMMENT ON COLUMN admin.account_grants.grant_scan IS 'id Скану';
|
|
115
|
-
COMMENT ON COLUMN admin.account_grants.expire_date IS 'Дата закінчення дії дозволу';
|
|
116
|
-
COMMENT ON COLUMN admin.account_grants.actions IS 'Дії';
|
|
117
|
-
COMMENT ON COLUMN admin.account_grants.uid IS 'Хто створив';
|
|
118
|
-
COMMENT ON COLUMN admin.account_grants.cdate IS 'Дата створення';
|
|
119
|
-
ALTER TABLE admin.account_grants ALTER COLUMN account_id DROP NOT NULL;
|
|
120
|
-
ALTER TABLE admin.account_grants ALTER COLUMN actions DROP NOT NULL;
|
|
121
|
-
ALTER TABLE admin.account_grants ALTER COLUMN ag_id SET NOT NULL;ALTER TABLE admin.account_grants ALTER COLUMN ag_id SET DEFAULT next_id();
|
|
122
|
-
ALTER TABLE admin.account_grants ALTER COLUMN cdate DROP NOT NULL;ALTER TABLE admin.account_grants ALTER COLUMN cdate SET DEFAULT (now())::timestamp without time zone;
|
|
123
|
-
ALTER TABLE admin.account_grants ALTER COLUMN expire_date DROP NOT NULL;
|
|
124
|
-
ALTER TABLE admin.account_grants ALTER COLUMN grant_scan DROP NOT NULL;
|
|
125
|
-
ALTER TABLE admin.account_grants ALTER COLUMN grants_doc_id DROP NOT NULL;
|
|
126
|
-
ALTER TABLE admin.account_grants ALTER COLUMN routes DROP NOT NULL;
|
|
127
|
-
ALTER TABLE admin.account_grants ALTER COLUMN rule_id DROP NOT NULL;
|
|
128
|
-
ALTER TABLE admin.account_grants ALTER COLUMN rule_values DROP NOT NULL;
|
|
129
|
-
ALTER TABLE admin.account_grants ALTER COLUMN uid DROP NOT NULL;
|
|
130
|
-
ALTER TABLE admin.account_grants add CONSTRAINT admin_account_grants_pkey PRIMARY KEY (ag_id);
|
|
131
|
-
ALTER TABLE admin.account_grants ADD CONSTRAINT admin_ag_account_fkey FOREIGN KEY (account_id) REFERENCES admin.accounts (account_id) MATCH SIMPLE;
|
|
132
|
-
ALTER TABLE admin.account_grants ADD CONSTRAINT admin_ag_user_fkey FOREIGN KEY (rule_id) REFERENCES admin.rules (rule_id) MATCH SIMPLE;
|
|
133
|
-
|
|
134
|
-
CREATE INDEX if not exists admin_account_users_id_idx ON admin.account_grants USING btree (ag_id COLLATE pg_catalog."default");
|
|
135
|
-
CREATE INDEX if not exists admin_ag_account_id_idx ON admin.account_grants USING btree (account_id COLLATE pg_catalog."default");
|
|
136
|
-
CREATE INDEX if not exists admin_ag_rule_id_idx ON admin.account_grants USING btree (rule_id COLLATE pg_catalog."default");
|
|
1
|
+
CREATE SCHEMA IF NOT EXISTS admin;
|
|
2
|
+
|
|
3
|
+
CREATE TABLE IF NOT EXISTS admin.rules();
|
|
4
|
+
CREATE TABLE IF NOT EXISTS admin.users( uid text not null constraint admin_user_uid_pkey PRIMARY KEY DEFAULT next_id() );
|
|
5
|
+
ALTER TABLE admin.rules DROP CONSTRAINT IF EXISTS admin_rules_pkey cascade;
|
|
6
|
+
ALTER TABLE admin.rules add column if not exists rule_id text NOT NULL DEFAULT next_id();
|
|
7
|
+
|
|
8
|
+
ALTER TABLE admin.rules add column if not exists rule_type text;
|
|
9
|
+
ALTER TABLE admin.rules add column if not exists rule_name text;
|
|
10
|
+
ALTER TABLE admin.rules add column if not exists attr text;
|
|
11
|
+
ALTER TABLE admin.rules add column if not exists routes text[];
|
|
12
|
+
ALTER TABLE admin.rules add column if not exists uid text;
|
|
13
|
+
ALTER TABLE admin.rules add column if not exists cdate timestamp without time zone;
|
|
14
|
+
ALTER TABLE admin.rules add column if not exists rule_query text;
|
|
15
|
+
ALTER TABLE admin.rules add column if not exists cls text;
|
|
16
|
+
COMMENT ON TABLE admin.rules IS 'Повноваження';
|
|
17
|
+
COMMENT ON COLUMN admin.rules.rule_type IS 'Тип повноваження';
|
|
18
|
+
COMMENT ON COLUMN admin.rules.rule_name IS 'Назва';
|
|
19
|
+
COMMENT ON COLUMN admin.rules.attr IS 'Атрибут';
|
|
20
|
+
COMMENT ON COLUMN admin.rules.routes IS 'Роути';
|
|
21
|
+
COMMENT ON COLUMN admin.rules.uid IS 'Хто створив';
|
|
22
|
+
COMMENT ON COLUMN admin.rules.cdate IS 'Дата створення';
|
|
23
|
+
COMMENT ON COLUMN admin.rules.rule_query IS 'Запит';
|
|
24
|
+
COMMENT ON COLUMN admin.rules.cls IS 'Класифікатор';
|
|
25
|
+
ALTER TABLE admin.rules ALTER COLUMN attr DROP NOT NULL;
|
|
26
|
+
ALTER TABLE admin.rules ALTER COLUMN cdate DROP NOT NULL;ALTER TABLE admin.rules ALTER COLUMN cdate SET DEFAULT (now())::timestamp without time zone;
|
|
27
|
+
ALTER TABLE admin.rules ALTER COLUMN cls DROP NOT NULL;
|
|
28
|
+
ALTER TABLE admin.rules ALTER COLUMN routes DROP NOT NULL;
|
|
29
|
+
ALTER TABLE admin.rules ALTER COLUMN rule_id SET NOT NULL;ALTER TABLE admin.rules ALTER COLUMN rule_id SET DEFAULT next_id();
|
|
30
|
+
ALTER TABLE admin.rules ALTER COLUMN rule_name DROP NOT NULL;
|
|
31
|
+
ALTER TABLE admin.rules ALTER COLUMN rule_query DROP NOT NULL;
|
|
32
|
+
ALTER TABLE admin.rules ALTER COLUMN rule_type DROP NOT NULL;
|
|
33
|
+
ALTER TABLE admin.rules ALTER COLUMN uid DROP NOT NULL;
|
|
34
|
+
ALTER TABLE admin.rules add CONSTRAINT admin_rules_pkey PRIMARY KEY (rule_id);
|
|
35
|
+
|
|
36
|
+
CREATE INDEX if not exists admin_rules_id_idx ON admin.rules USING btree (rule_id COLLATE pg_catalog."default");
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
CREATE TABLE IF NOT EXISTS admin.accounts();
|
|
40
|
+
ALTER TABLE admin.accounts DROP CONSTRAINT IF EXISTS admin_accounts_pkey cascade;
|
|
41
|
+
ALTER TABLE admin.accounts add column if not exists account_id text NOT NULL DEFAULT next_id();
|
|
42
|
+
|
|
43
|
+
ALTER TABLE admin.accounts add column if not exists account_name text;
|
|
44
|
+
ALTER TABLE admin.accounts add column if not exists description text;
|
|
45
|
+
ALTER TABLE admin.accounts add column if not exists uid text;
|
|
46
|
+
ALTER TABLE admin.accounts add column if not exists cdate timestamp without time zone;
|
|
47
|
+
COMMENT ON TABLE admin.accounts IS 'Організації';
|
|
48
|
+
COMMENT ON COLUMN admin.accounts.account_name IS 'Назва';
|
|
49
|
+
COMMENT ON COLUMN admin.accounts.description IS 'Опис';
|
|
50
|
+
COMMENT ON COLUMN admin.accounts.uid IS 'Хто створив';
|
|
51
|
+
COMMENT ON COLUMN admin.accounts.cdate IS 'Дата створення';
|
|
52
|
+
ALTER TABLE admin.accounts ALTER COLUMN account_id SET NOT NULL;ALTER TABLE admin.accounts ALTER COLUMN account_id SET DEFAULT next_id();
|
|
53
|
+
ALTER TABLE admin.accounts ALTER COLUMN account_name DROP NOT NULL;
|
|
54
|
+
ALTER TABLE admin.accounts ALTER COLUMN cdate DROP NOT NULL;ALTER TABLE admin.accounts ALTER COLUMN cdate SET DEFAULT (now())::timestamp without time zone;
|
|
55
|
+
ALTER TABLE admin.accounts ALTER COLUMN description DROP NOT NULL;
|
|
56
|
+
ALTER TABLE admin.accounts ALTER COLUMN uid DROP NOT NULL;
|
|
57
|
+
ALTER TABLE admin.accounts add CONSTRAINT admin_accounts_pkey PRIMARY KEY (account_id);
|
|
58
|
+
|
|
59
|
+
CREATE INDEX if not exists admin_accounts_id_idx ON admin.accounts USING btree (account_id COLLATE pg_catalog."default");
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
CREATE TABLE IF NOT EXISTS admin.account_users();
|
|
64
|
+
ALTER TABLE admin.account_users DROP CONSTRAINT IF EXISTS admin_account_users_pkey;
|
|
65
|
+
ALTER TABLE admin.account_users DROP CONSTRAINT IF EXISTS admin_au_account_fkey;
|
|
66
|
+
ALTER TABLE admin.account_users DROP CONSTRAINT IF EXISTS admin_au_user_fkey;
|
|
67
|
+
ALTER TABLE admin.account_users add column if not exists au_id text NOT NULL DEFAULT next_id();
|
|
68
|
+
|
|
69
|
+
ALTER TABLE admin.account_users add column if not exists account_id text;
|
|
70
|
+
ALTER TABLE admin.account_users add column if not exists user_uid text;
|
|
71
|
+
ALTER TABLE admin.account_users add column if not exists uid text;
|
|
72
|
+
ALTER TABLE admin.account_users add column if not exists cdate timestamp without time zone;
|
|
73
|
+
COMMENT ON TABLE admin.account_users IS 'Організації - Користувачі';
|
|
74
|
+
COMMENT ON COLUMN admin.account_users.account_id IS 'id Організації';
|
|
75
|
+
COMMENT ON COLUMN admin.account_users.user_uid IS 'id Користувача';
|
|
76
|
+
COMMENT ON COLUMN admin.account_users.uid IS 'Хто створив';
|
|
77
|
+
COMMENT ON COLUMN admin.account_users.cdate IS 'Дата створення';
|
|
78
|
+
ALTER TABLE admin.account_users ALTER COLUMN account_id DROP NOT NULL;
|
|
79
|
+
ALTER TABLE admin.account_users ALTER COLUMN au_id SET NOT NULL;ALTER TABLE admin.account_users ALTER COLUMN au_id SET DEFAULT next_id();
|
|
80
|
+
ALTER TABLE admin.account_users ALTER COLUMN cdate DROP NOT NULL;ALTER TABLE admin.account_users ALTER COLUMN cdate SET DEFAULT (now())::timestamp without time zone;
|
|
81
|
+
ALTER TABLE admin.account_users ALTER COLUMN uid DROP NOT NULL;
|
|
82
|
+
ALTER TABLE admin.account_users ALTER COLUMN user_uid DROP NOT NULL;
|
|
83
|
+
ALTER TABLE admin.account_users add CONSTRAINT admin_account_users_pkey PRIMARY KEY (au_id);
|
|
84
|
+
ALTER TABLE admin.account_users ADD CONSTRAINT admin_au_account_fkey FOREIGN KEY (account_id) REFERENCES admin.accounts (account_id) MATCH SIMPLE;
|
|
85
|
+
ALTER TABLE admin.account_users ADD CONSTRAINT admin_au_user_fkey FOREIGN KEY (user_uid) REFERENCES admin.users (uid) MATCH SIMPLE;
|
|
86
|
+
|
|
87
|
+
CREATE INDEX if not exists admin_account_users_id_idx ON admin.account_users USING btree (au_id COLLATE pg_catalog."default");
|
|
88
|
+
CREATE INDEX if not exists admin_au_account_id_idx ON admin.account_users USING btree (account_id COLLATE pg_catalog."default");
|
|
89
|
+
CREATE INDEX if not exists admin_au_user_uid_idx ON admin.account_users USING btree (user_uid COLLATE pg_catalog."default");
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
CREATE TABLE IF NOT EXISTS admin.account_grants();
|
|
93
|
+
ALTER TABLE admin.account_grants DROP CONSTRAINT IF EXISTS admin_account_grants_pkey;
|
|
94
|
+
ALTER TABLE admin.account_grants DROP CONSTRAINT IF EXISTS admin_ag_account_fkey;
|
|
95
|
+
ALTER TABLE admin.account_grants DROP CONSTRAINT IF EXISTS admin_ag_user_fkey;
|
|
96
|
+
ALTER TABLE admin.account_grants add column if not exists ag_id text NOT NULL DEFAULT next_id();
|
|
97
|
+
|
|
98
|
+
ALTER TABLE admin.account_grants add column if not exists account_id text;
|
|
99
|
+
ALTER TABLE admin.account_grants add column if not exists rule_id text;
|
|
100
|
+
ALTER TABLE admin.account_grants add column if not exists routes text[];
|
|
101
|
+
ALTER TABLE admin.account_grants add column if not exists rule_values text[];
|
|
102
|
+
ALTER TABLE admin.account_grants add column if not exists grants_doc_id text;
|
|
103
|
+
ALTER TABLE admin.account_grants add column if not exists grant_scan text;
|
|
104
|
+
ALTER TABLE admin.account_grants add column if not exists expire_date date;
|
|
105
|
+
ALTER TABLE admin.account_grants add column if not exists actions text[];
|
|
106
|
+
ALTER TABLE admin.account_grants add column if not exists uid text;
|
|
107
|
+
ALTER TABLE admin.account_grants add column if not exists cdate timestamp without time zone;
|
|
108
|
+
COMMENT ON TABLE admin.account_grants IS 'Організації - Повноваження';
|
|
109
|
+
COMMENT ON COLUMN admin.account_grants.account_id IS 'id Організації';
|
|
110
|
+
COMMENT ON COLUMN admin.account_grants.rule_id IS 'id Правила';
|
|
111
|
+
COMMENT ON COLUMN admin.account_grants.routes IS 'Роути';
|
|
112
|
+
COMMENT ON COLUMN admin.account_grants.rule_values IS 'Значення';
|
|
113
|
+
COMMENT ON COLUMN admin.account_grants.grants_doc_id IS 'id Документу';
|
|
114
|
+
COMMENT ON COLUMN admin.account_grants.grant_scan IS 'id Скану';
|
|
115
|
+
COMMENT ON COLUMN admin.account_grants.expire_date IS 'Дата закінчення дії дозволу';
|
|
116
|
+
COMMENT ON COLUMN admin.account_grants.actions IS 'Дії';
|
|
117
|
+
COMMENT ON COLUMN admin.account_grants.uid IS 'Хто створив';
|
|
118
|
+
COMMENT ON COLUMN admin.account_grants.cdate IS 'Дата створення';
|
|
119
|
+
ALTER TABLE admin.account_grants ALTER COLUMN account_id DROP NOT NULL;
|
|
120
|
+
ALTER TABLE admin.account_grants ALTER COLUMN actions DROP NOT NULL;
|
|
121
|
+
ALTER TABLE admin.account_grants ALTER COLUMN ag_id SET NOT NULL;ALTER TABLE admin.account_grants ALTER COLUMN ag_id SET DEFAULT next_id();
|
|
122
|
+
ALTER TABLE admin.account_grants ALTER COLUMN cdate DROP NOT NULL;ALTER TABLE admin.account_grants ALTER COLUMN cdate SET DEFAULT (now())::timestamp without time zone;
|
|
123
|
+
ALTER TABLE admin.account_grants ALTER COLUMN expire_date DROP NOT NULL;
|
|
124
|
+
ALTER TABLE admin.account_grants ALTER COLUMN grant_scan DROP NOT NULL;
|
|
125
|
+
ALTER TABLE admin.account_grants ALTER COLUMN grants_doc_id DROP NOT NULL;
|
|
126
|
+
ALTER TABLE admin.account_grants ALTER COLUMN routes DROP NOT NULL;
|
|
127
|
+
ALTER TABLE admin.account_grants ALTER COLUMN rule_id DROP NOT NULL;
|
|
128
|
+
ALTER TABLE admin.account_grants ALTER COLUMN rule_values DROP NOT NULL;
|
|
129
|
+
ALTER TABLE admin.account_grants ALTER COLUMN uid DROP NOT NULL;
|
|
130
|
+
ALTER TABLE admin.account_grants add CONSTRAINT admin_account_grants_pkey PRIMARY KEY (ag_id);
|
|
131
|
+
ALTER TABLE admin.account_grants ADD CONSTRAINT admin_ag_account_fkey FOREIGN KEY (account_id) REFERENCES admin.accounts (account_id) MATCH SIMPLE;
|
|
132
|
+
ALTER TABLE admin.account_grants ADD CONSTRAINT admin_ag_user_fkey FOREIGN KEY (rule_id) REFERENCES admin.rules (rule_id) MATCH SIMPLE;
|
|
133
|
+
|
|
134
|
+
CREATE INDEX if not exists admin_account_users_id_idx ON admin.account_grants USING btree (ag_id COLLATE pg_catalog."default");
|
|
135
|
+
CREATE INDEX if not exists admin_ag_account_id_idx ON admin.account_grants USING btree (account_id COLLATE pg_catalog."default");
|
|
136
|
+
CREATE INDEX if not exists admin_ag_rule_id_idx ON admin.account_grants USING btree (rule_id COLLATE pg_catalog."default");
|
|
137
137
|
*/
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
CREATE schema if not exists oauth;
|
|
2
|
-
|
|
3
|
-
CREATE TABLE if not exists oauth.clients (
|
|
4
|
-
client_id text PRIMARY KEY DEFAULT next_id(), -- ID клієнта (публічний ідентифікатор)
|
|
5
|
-
client_secret_hash text, -- Хеш секрету (NULL для public-клієнтів)
|
|
6
|
-
name text NOT NULL, -- Назва застосунку
|
|
7
|
-
type text NOT NULL CHECK (type IN ('public','confidential')),
|
|
8
|
-
token_endpoint_auth_method text NOT NULL CHECK (token_endpoint_auth_method IN ('client_secret_basic','client_secret_post','private_key_jwt','none')),
|
|
9
|
-
owner_user_id text, -- Власник/адміністратор клієнта (посилання на users.id or other id)
|
|
10
|
-
|
|
11
|
-
redirect_uris text[], -- Дозволені redirect_uri
|
|
12
|
-
grant_types text[] CHECK (case when grant_types is not null then grant_types <@ ARRAY['authorization_code','refresh_token','client_credentials','device_code']::text[] else true end),
|
|
13
|
-
require_pkce boolean NOT NULL DEFAULT true,
|
|
14
|
-
scopes text[],
|
|
15
|
-
allowed_cors_origins text[],
|
|
16
|
-
jwks jsonb, -- Вбудований JWK Set (опційно)
|
|
17
|
-
|
|
18
|
-
created_at timestamptz NOT NULL DEFAULT now(),
|
|
19
|
-
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
20
|
-
allowed_ips text[]
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
CREATE TABLE if not exists oauth.tokens (
|
|
24
|
-
id text PRIMARY KEY DEFAULT next_id(),
|
|
25
|
-
token_type text NOT NULL CHECK (token_type IN ('access','refresh')),
|
|
26
|
-
token_hash text NOT NULL UNIQUE, -- Argon2/bcrypt/SCrypt (хеш у застосунку)
|
|
27
|
-
token_hint text, -- останні 6-8 символів для діагностики (необов’язково)
|
|
28
|
-
jti text UNIQUE, -- JWT ID, якщо токен — JWT
|
|
29
|
-
client_id text NOT NULL REFERENCES oauth.clients(client_id) ON DELETE CASCADE,
|
|
30
|
-
user_id text, -- NULL для client_credentials
|
|
31
|
-
issuer text, -- iss
|
|
32
|
-
scopes text[],
|
|
33
|
-
claims jsonb, -- додаткові клейми
|
|
34
|
-
issued_at timestamptz NOT NULL DEFAULT now(),
|
|
35
|
-
expires_at timestamptz NOT NULL,
|
|
36
|
-
revoked_at timestamptz,
|
|
37
|
-
revocation_reason text,
|
|
38
|
-
ip inet -- IP видачі/використання (опційно)
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
COMMENT ON SCHEMA oauth IS 'Schema for OAuth2 / OpenID Connect clients and tokens';
|
|
42
|
-
|
|
43
|
-
-- Comments for oauth.clients
|
|
44
|
-
COMMENT ON TABLE oauth.clients IS 'OAuth 2.0 clients (applications) that can request tokens';
|
|
45
|
-
|
|
46
|
-
COMMENT ON COLUMN oauth.clients.client_id IS 'Client identifier (public ID, generated by next_id())';
|
|
47
|
-
COMMENT ON COLUMN oauth.clients.client_secret_hash IS 'Hashed client secret (NULL for public clients)';
|
|
48
|
-
COMMENT ON COLUMN oauth.clients.name IS 'Name of the application/client';
|
|
49
|
-
COMMENT ON COLUMN oauth.clients.type IS 'Client type: public or confidential';
|
|
50
|
-
COMMENT ON COLUMN oauth.clients.token_endpoint_auth_method IS 'Authentication method at token endpoint (client_secret_basic, client_secret_post, private_key_jwt, none)';
|
|
51
|
-
COMMENT ON COLUMN oauth.clients.owner_user_id IS 'Owner/administrator of the client (reference to users.id or external id)';
|
|
52
|
-
COMMENT ON COLUMN oauth.clients.redirect_uris IS 'Allowed redirect URIs';
|
|
53
|
-
COMMENT ON COLUMN oauth.clients.grant_types IS 'Allowed grant types (authorization_code, refresh_token, client_credentials, device_code)';
|
|
54
|
-
COMMENT ON COLUMN oauth.clients.require_pkce IS 'Whether PKCE is required (default true)';
|
|
55
|
-
COMMENT ON COLUMN oauth.clients.scopes IS 'Allowed OAuth2 scopes';
|
|
56
|
-
COMMENT ON COLUMN oauth.clients.allowed_cors_origins IS 'Allowed CORS origins for browser-based apps';
|
|
57
|
-
COMMENT ON COLUMN oauth.clients.jwks IS 'Embedded JSON Web Key Set (optional)';
|
|
58
|
-
COMMENT ON COLUMN oauth.clients.created_at IS 'Creation timestamp';
|
|
59
|
-
COMMENT ON COLUMN oauth.clients.updated_at IS 'Last update timestamp';
|
|
60
|
-
|
|
61
|
-
-- Comments for oauth.tokens
|
|
62
|
-
COMMENT ON TABLE oauth.tokens IS 'Issued OAuth 2.0 tokens (access or refresh)';
|
|
63
|
-
|
|
64
|
-
COMMENT ON COLUMN oauth.tokens.id IS 'Internal token ID (generated by next_id())';
|
|
65
|
-
COMMENT ON COLUMN oauth.tokens.token_type IS 'Type of token: access or refresh';
|
|
66
|
-
COMMENT ON COLUMN oauth.tokens.token_hash IS 'Secure hash of the token (Argon2/bcrypt/SCrypt)';
|
|
67
|
-
COMMENT ON COLUMN oauth.tokens.token_hint IS 'Optional hint (last 6–8 characters of token) for diagnostics';
|
|
68
|
-
COMMENT ON COLUMN oauth.tokens.jti IS 'JWT ID if token is a JWT (unique)';
|
|
69
|
-
COMMENT ON COLUMN oauth.tokens.client_id IS 'Reference to oauth.clients (issuing client)';
|
|
70
|
-
COMMENT ON COLUMN oauth.tokens.user_id IS 'User ID if bound to user (NULL for client_credentials flow)';
|
|
71
|
-
COMMENT ON COLUMN oauth.tokens.issuer IS 'Token issuer (iss claim)';
|
|
72
|
-
COMMENT ON COLUMN oauth.tokens.scopes IS 'Granted OAuth2 scopes for this token';
|
|
73
|
-
COMMENT ON COLUMN oauth.tokens.claims IS 'Additional claims (JSONB)';
|
|
74
|
-
COMMENT ON COLUMN oauth.tokens.issued_at IS 'Timestamp when issued';
|
|
75
|
-
COMMENT ON COLUMN oauth.tokens.expires_at IS 'Timestamp when token expires';
|
|
76
|
-
COMMENT ON COLUMN oauth.tokens.revoked_at IS 'Timestamp when revoked';
|
|
77
|
-
COMMENT ON COLUMN oauth.tokens.revocation_reason IS 'Reason for revocation (if any)';
|
|
78
|
-
COMMENT ON COLUMN oauth.tokens.ip IS 'IP address of issuance/usage (optional)';
|
|
79
|
-
|
|
1
|
+
CREATE schema if not exists oauth;
|
|
2
|
+
|
|
3
|
+
CREATE TABLE if not exists oauth.clients (
|
|
4
|
+
client_id text PRIMARY KEY DEFAULT next_id(), -- ID клієнта (публічний ідентифікатор)
|
|
5
|
+
client_secret_hash text, -- Хеш секрету (NULL для public-клієнтів)
|
|
6
|
+
name text NOT NULL, -- Назва застосунку
|
|
7
|
+
type text NOT NULL CHECK (type IN ('public','confidential')),
|
|
8
|
+
token_endpoint_auth_method text NOT NULL CHECK (token_endpoint_auth_method IN ('client_secret_basic','client_secret_post','private_key_jwt','none')),
|
|
9
|
+
owner_user_id text, -- Власник/адміністратор клієнта (посилання на users.id or other id)
|
|
10
|
+
|
|
11
|
+
redirect_uris text[], -- Дозволені redirect_uri
|
|
12
|
+
grant_types text[] CHECK (case when grant_types is not null then grant_types <@ ARRAY['authorization_code','refresh_token','client_credentials','device_code']::text[] else true end),
|
|
13
|
+
require_pkce boolean NOT NULL DEFAULT true,
|
|
14
|
+
scopes text[],
|
|
15
|
+
allowed_cors_origins text[],
|
|
16
|
+
jwks jsonb, -- Вбудований JWK Set (опційно)
|
|
17
|
+
|
|
18
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
19
|
+
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
20
|
+
allowed_ips text[]
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
CREATE TABLE if not exists oauth.tokens (
|
|
24
|
+
id text PRIMARY KEY DEFAULT next_id(),
|
|
25
|
+
token_type text NOT NULL CHECK (token_type IN ('access','refresh')),
|
|
26
|
+
token_hash text NOT NULL UNIQUE, -- Argon2/bcrypt/SCrypt (хеш у застосунку)
|
|
27
|
+
token_hint text, -- останні 6-8 символів для діагностики (необов’язково)
|
|
28
|
+
jti text UNIQUE, -- JWT ID, якщо токен — JWT
|
|
29
|
+
client_id text NOT NULL REFERENCES oauth.clients(client_id) ON DELETE CASCADE,
|
|
30
|
+
user_id text, -- NULL для client_credentials
|
|
31
|
+
issuer text, -- iss
|
|
32
|
+
scopes text[],
|
|
33
|
+
claims jsonb, -- додаткові клейми
|
|
34
|
+
issued_at timestamptz NOT NULL DEFAULT now(),
|
|
35
|
+
expires_at timestamptz NOT NULL,
|
|
36
|
+
revoked_at timestamptz,
|
|
37
|
+
revocation_reason text,
|
|
38
|
+
ip inet -- IP видачі/використання (опційно)
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
COMMENT ON SCHEMA oauth IS 'Schema for OAuth2 / OpenID Connect clients and tokens';
|
|
42
|
+
|
|
43
|
+
-- Comments for oauth.clients
|
|
44
|
+
COMMENT ON TABLE oauth.clients IS 'OAuth 2.0 clients (applications) that can request tokens';
|
|
45
|
+
|
|
46
|
+
COMMENT ON COLUMN oauth.clients.client_id IS 'Client identifier (public ID, generated by next_id())';
|
|
47
|
+
COMMENT ON COLUMN oauth.clients.client_secret_hash IS 'Hashed client secret (NULL for public clients)';
|
|
48
|
+
COMMENT ON COLUMN oauth.clients.name IS 'Name of the application/client';
|
|
49
|
+
COMMENT ON COLUMN oauth.clients.type IS 'Client type: public or confidential';
|
|
50
|
+
COMMENT ON COLUMN oauth.clients.token_endpoint_auth_method IS 'Authentication method at token endpoint (client_secret_basic, client_secret_post, private_key_jwt, none)';
|
|
51
|
+
COMMENT ON COLUMN oauth.clients.owner_user_id IS 'Owner/administrator of the client (reference to users.id or external id)';
|
|
52
|
+
COMMENT ON COLUMN oauth.clients.redirect_uris IS 'Allowed redirect URIs';
|
|
53
|
+
COMMENT ON COLUMN oauth.clients.grant_types IS 'Allowed grant types (authorization_code, refresh_token, client_credentials, device_code)';
|
|
54
|
+
COMMENT ON COLUMN oauth.clients.require_pkce IS 'Whether PKCE is required (default true)';
|
|
55
|
+
COMMENT ON COLUMN oauth.clients.scopes IS 'Allowed OAuth2 scopes';
|
|
56
|
+
COMMENT ON COLUMN oauth.clients.allowed_cors_origins IS 'Allowed CORS origins for browser-based apps';
|
|
57
|
+
COMMENT ON COLUMN oauth.clients.jwks IS 'Embedded JSON Web Key Set (optional)';
|
|
58
|
+
COMMENT ON COLUMN oauth.clients.created_at IS 'Creation timestamp';
|
|
59
|
+
COMMENT ON COLUMN oauth.clients.updated_at IS 'Last update timestamp';
|
|
60
|
+
|
|
61
|
+
-- Comments for oauth.tokens
|
|
62
|
+
COMMENT ON TABLE oauth.tokens IS 'Issued OAuth 2.0 tokens (access or refresh)';
|
|
63
|
+
|
|
64
|
+
COMMENT ON COLUMN oauth.tokens.id IS 'Internal token ID (generated by next_id())';
|
|
65
|
+
COMMENT ON COLUMN oauth.tokens.token_type IS 'Type of token: access or refresh';
|
|
66
|
+
COMMENT ON COLUMN oauth.tokens.token_hash IS 'Secure hash of the token (Argon2/bcrypt/SCrypt)';
|
|
67
|
+
COMMENT ON COLUMN oauth.tokens.token_hint IS 'Optional hint (last 6–8 characters of token) for diagnostics';
|
|
68
|
+
COMMENT ON COLUMN oauth.tokens.jti IS 'JWT ID if token is a JWT (unique)';
|
|
69
|
+
COMMENT ON COLUMN oauth.tokens.client_id IS 'Reference to oauth.clients (issuing client)';
|
|
70
|
+
COMMENT ON COLUMN oauth.tokens.user_id IS 'User ID if bound to user (NULL for client_credentials flow)';
|
|
71
|
+
COMMENT ON COLUMN oauth.tokens.issuer IS 'Token issuer (iss claim)';
|
|
72
|
+
COMMENT ON COLUMN oauth.tokens.scopes IS 'Granted OAuth2 scopes for this token';
|
|
73
|
+
COMMENT ON COLUMN oauth.tokens.claims IS 'Additional claims (JSONB)';
|
|
74
|
+
COMMENT ON COLUMN oauth.tokens.issued_at IS 'Timestamp when issued';
|
|
75
|
+
COMMENT ON COLUMN oauth.tokens.expires_at IS 'Timestamp when token expires';
|
|
76
|
+
COMMENT ON COLUMN oauth.tokens.revoked_at IS 'Timestamp when revoked';
|
|
77
|
+
COMMENT ON COLUMN oauth.tokens.revocation_reason IS 'Reason for revocation (if any)';
|
|
78
|
+
COMMENT ON COLUMN oauth.tokens.ip IS 'IP address of issuance/usage (optional)';
|
|
79
|
+
|
|
80
80
|
alter table oauth.clients add column if not exists allowed_ips text[];
|