@pgpm/metaschema-modules 0.16.8 → 0.18.0
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 +7 -8
- package/deploy/schemas/metaschema_modules_public/tables/field_module/table.sql +6 -1
- package/deploy/schemas/metaschema_modules_public/tables/profiles_module/table.sql +0 -2
- package/deploy/schemas/metaschema_modules_public/tables/relation_provision/table.sql +287 -0
- package/deploy/schemas/metaschema_modules_public/tables/rls_module/table.sql +6 -3
- package/deploy/schemas/metaschema_modules_public/tables/secure_table_provision/table.sql +109 -0
- package/deploy/schemas/metaschema_modules_public/tables/table_module/table.sql +10 -7
- package/deploy/schemas/metaschema_modules_public/tables/table_template_module/table.sql +5 -0
- package/package.json +5 -6
- package/pgpm.plan +2 -0
- package/revert/schemas/metaschema_modules_public/tables/field_module/table.sql +1 -1
- package/revert/schemas/metaschema_modules_public/tables/relation_provision/table.sql +7 -0
- package/revert/schemas/metaschema_modules_public/tables/secure_table_provision/table.sql +7 -0
- package/sql/metaschema-modules--0.15.5.sql +329 -99
- package/verify/schemas/metaschema_modules_public/tables/field_module/table.sql +3 -1
- package/verify/schemas/metaschema_modules_public/tables/profiles_module/table.sql +1 -1
- package/verify/schemas/metaschema_modules_public/tables/relation_provision/table.sql +36 -0
- package/verify/schemas/metaschema_modules_public/tables/secure_table_provision/table.sql +26 -0
- package/verify/schemas/metaschema_modules_public/tables/table_module/table.sql +3 -1
|
@@ -37,11 +37,11 @@ CREATE TABLE metaschema_modules_public.connected_accounts_module (
|
|
|
37
37
|
ON DELETE CASCADE,
|
|
38
38
|
CONSTRAINT table_fkey
|
|
39
39
|
FOREIGN KEY(table_id)
|
|
40
|
-
REFERENCES metaschema_public.table (id)
|
|
40
|
+
REFERENCES metaschema_public."table" (id)
|
|
41
41
|
ON DELETE CASCADE,
|
|
42
42
|
CONSTRAINT owner_table_fkey
|
|
43
43
|
FOREIGN KEY(owner_table_id)
|
|
44
|
-
REFERENCES metaschema_public.table (id)
|
|
44
|
+
REFERENCES metaschema_public."table" (id)
|
|
45
45
|
ON DELETE CASCADE,
|
|
46
46
|
CONSTRAINT schema_fkey
|
|
47
47
|
FOREIGN KEY(schema_id)
|
|
@@ -80,11 +80,11 @@ CREATE TABLE metaschema_modules_public.crypto_addresses_module (
|
|
|
80
80
|
ON DELETE CASCADE,
|
|
81
81
|
CONSTRAINT table_fkey
|
|
82
82
|
FOREIGN KEY(table_id)
|
|
83
|
-
REFERENCES metaschema_public.table (id)
|
|
83
|
+
REFERENCES metaschema_public."table" (id)
|
|
84
84
|
ON DELETE CASCADE,
|
|
85
85
|
CONSTRAINT owner_table_fkey
|
|
86
86
|
FOREIGN KEY(owner_table_id)
|
|
87
|
-
REFERENCES metaschema_public.table (id)
|
|
87
|
+
REFERENCES metaschema_public."table" (id)
|
|
88
88
|
ON DELETE CASCADE,
|
|
89
89
|
CONSTRAINT schema_fkey
|
|
90
90
|
FOREIGN KEY(schema_id)
|
|
@@ -113,8 +113,9 @@ CREATE TABLE metaschema_modules_public.crypto_auth_module (
|
|
|
113
113
|
database_id uuid NOT NULL,
|
|
114
114
|
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
115
115
|
users_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
116
|
-
tokens_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
117
116
|
secrets_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
117
|
+
sessions_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
118
|
+
session_credentials_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
118
119
|
addresses_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
119
120
|
user_field text NOT NULL,
|
|
120
121
|
crypto_network text NOT NULL DEFAULT 'BTC',
|
|
@@ -128,15 +129,19 @@ CREATE TABLE metaschema_modules_public.crypto_auth_module (
|
|
|
128
129
|
ON DELETE CASCADE,
|
|
129
130
|
CONSTRAINT secrets_table_fkey
|
|
130
131
|
FOREIGN KEY(secrets_table_id)
|
|
131
|
-
REFERENCES metaschema_public.table (id)
|
|
132
|
+
REFERENCES metaschema_public."table" (id)
|
|
132
133
|
ON DELETE CASCADE,
|
|
133
134
|
CONSTRAINT users_table_fkey
|
|
134
135
|
FOREIGN KEY(users_table_id)
|
|
135
|
-
REFERENCES metaschema_public.table (id)
|
|
136
|
+
REFERENCES metaschema_public."table" (id)
|
|
136
137
|
ON DELETE CASCADE,
|
|
137
|
-
CONSTRAINT
|
|
138
|
-
FOREIGN KEY(
|
|
139
|
-
REFERENCES metaschema_public.table (id)
|
|
138
|
+
CONSTRAINT sessions_table_fkey
|
|
139
|
+
FOREIGN KEY(sessions_table_id)
|
|
140
|
+
REFERENCES metaschema_public."table" (id)
|
|
141
|
+
ON DELETE CASCADE,
|
|
142
|
+
CONSTRAINT session_credentials_table_fkey
|
|
143
|
+
FOREIGN KEY(session_credentials_table_id)
|
|
144
|
+
REFERENCES metaschema_public."table" (id)
|
|
140
145
|
ON DELETE CASCADE,
|
|
141
146
|
CONSTRAINT schema_fkey
|
|
142
147
|
FOREIGN KEY(schema_id)
|
|
@@ -150,7 +155,9 @@ COMMENT ON CONSTRAINT secrets_table_fkey ON metaschema_modules_public.crypto_aut
|
|
|
150
155
|
|
|
151
156
|
COMMENT ON CONSTRAINT users_table_fkey ON metaschema_modules_public.crypto_auth_module IS '@omit manyToMany';
|
|
152
157
|
|
|
153
|
-
COMMENT ON CONSTRAINT
|
|
158
|
+
COMMENT ON CONSTRAINT sessions_table_fkey ON metaschema_modules_public.crypto_auth_module IS '@omit manyToMany';
|
|
159
|
+
|
|
160
|
+
COMMENT ON CONSTRAINT session_credentials_table_fkey ON metaschema_modules_public.crypto_auth_module IS '@omit manyToMany';
|
|
154
161
|
|
|
155
162
|
COMMENT ON CONSTRAINT schema_fkey ON metaschema_modules_public.crypto_auth_module IS '@omit manyToMany';
|
|
156
163
|
|
|
@@ -188,11 +195,11 @@ CREATE TABLE metaschema_modules_public.denormalized_table_field (
|
|
|
188
195
|
ON DELETE CASCADE,
|
|
189
196
|
CONSTRAINT table_fkey
|
|
190
197
|
FOREIGN KEY(table_id)
|
|
191
|
-
REFERENCES metaschema_public.table (id)
|
|
198
|
+
REFERENCES metaschema_public."table" (id)
|
|
192
199
|
ON DELETE CASCADE,
|
|
193
200
|
CONSTRAINT ref_table_fkey
|
|
194
201
|
FOREIGN KEY(ref_table_id)
|
|
195
|
-
REFERENCES metaschema_public.table (id)
|
|
202
|
+
REFERENCES metaschema_public."table" (id)
|
|
196
203
|
ON DELETE CASCADE,
|
|
197
204
|
CONSTRAINT field_fkey
|
|
198
205
|
FOREIGN KEY(field_id)
|
|
@@ -230,11 +237,11 @@ CREATE TABLE metaschema_modules_public.emails_module (
|
|
|
230
237
|
ON DELETE CASCADE,
|
|
231
238
|
CONSTRAINT table_fkey
|
|
232
239
|
FOREIGN KEY(table_id)
|
|
233
|
-
REFERENCES metaschema_public.table (id)
|
|
240
|
+
REFERENCES metaschema_public."table" (id)
|
|
234
241
|
ON DELETE CASCADE,
|
|
235
242
|
CONSTRAINT owner_table_fkey
|
|
236
243
|
FOREIGN KEY(owner_table_id)
|
|
237
|
-
REFERENCES metaschema_public.table (id)
|
|
244
|
+
REFERENCES metaschema_public."table" (id)
|
|
238
245
|
ON DELETE CASCADE,
|
|
239
246
|
CONSTRAINT schema_fkey
|
|
240
247
|
FOREIGN KEY(schema_id)
|
|
@@ -274,7 +281,7 @@ CREATE TABLE metaschema_modules_public.encrypted_secrets_module (
|
|
|
274
281
|
ON DELETE CASCADE,
|
|
275
282
|
CONSTRAINT table_fkey
|
|
276
283
|
FOREIGN KEY(table_id)
|
|
277
|
-
REFERENCES metaschema_public.table (id)
|
|
284
|
+
REFERENCES metaschema_public."table" (id)
|
|
278
285
|
ON DELETE CASCADE
|
|
279
286
|
);
|
|
280
287
|
|
|
@@ -292,6 +299,7 @@ CREATE TABLE metaschema_modules_public.field_module (
|
|
|
292
299
|
private_schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
293
300
|
table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
294
301
|
field_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
302
|
+
node_type text NOT NULL,
|
|
295
303
|
data jsonb NOT NULL DEFAULT '{}',
|
|
296
304
|
triggers text[],
|
|
297
305
|
functions text[],
|
|
@@ -301,7 +309,7 @@ CREATE TABLE metaschema_modules_public.field_module (
|
|
|
301
309
|
ON DELETE CASCADE,
|
|
302
310
|
CONSTRAINT table_fkey
|
|
303
311
|
FOREIGN KEY(table_id)
|
|
304
|
-
REFERENCES metaschema_public.table (id)
|
|
312
|
+
REFERENCES metaschema_public."table" (id)
|
|
305
313
|
ON DELETE CASCADE,
|
|
306
314
|
CONSTRAINT field_fkey
|
|
307
315
|
FOREIGN KEY(field_id)
|
|
@@ -323,6 +331,142 @@ COMMENT ON CONSTRAINT db_fkey ON metaschema_modules_public.field_module IS '@omi
|
|
|
323
331
|
|
|
324
332
|
CREATE INDEX field_module_database_id_idx ON metaschema_modules_public.field_module (database_id);
|
|
325
333
|
|
|
334
|
+
CREATE INDEX field_module_node_type_idx ON metaschema_modules_public.field_module (node_type);
|
|
335
|
+
|
|
336
|
+
CREATE TABLE metaschema_modules_public.table_module (
|
|
337
|
+
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
338
|
+
database_id uuid NOT NULL,
|
|
339
|
+
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
340
|
+
table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
341
|
+
table_name text DEFAULT NULL,
|
|
342
|
+
node_type text NOT NULL,
|
|
343
|
+
use_rls boolean NOT NULL DEFAULT true,
|
|
344
|
+
data jsonb NOT NULL DEFAULT '{}',
|
|
345
|
+
fields uuid[],
|
|
346
|
+
CONSTRAINT db_fkey
|
|
347
|
+
FOREIGN KEY(database_id)
|
|
348
|
+
REFERENCES metaschema_public.database (id)
|
|
349
|
+
ON DELETE CASCADE,
|
|
350
|
+
CONSTRAINT table_fkey
|
|
351
|
+
FOREIGN KEY(table_id)
|
|
352
|
+
REFERENCES metaschema_public."table" (id)
|
|
353
|
+
ON DELETE CASCADE,
|
|
354
|
+
CONSTRAINT schema_fkey
|
|
355
|
+
FOREIGN KEY(schema_id)
|
|
356
|
+
REFERENCES metaschema_public.schema (id)
|
|
357
|
+
ON DELETE CASCADE
|
|
358
|
+
);
|
|
359
|
+
|
|
360
|
+
COMMENT ON CONSTRAINT schema_fkey ON metaschema_modules_public.table_module IS '@omit manyToMany';
|
|
361
|
+
|
|
362
|
+
COMMENT ON CONSTRAINT table_fkey ON metaschema_modules_public.table_module IS '@omit manyToMany';
|
|
363
|
+
|
|
364
|
+
COMMENT ON CONSTRAINT db_fkey ON metaschema_modules_public.table_module IS '@omit manyToMany';
|
|
365
|
+
|
|
366
|
+
CREATE INDEX table_module_database_id_idx ON metaschema_modules_public.table_module (database_id);
|
|
367
|
+
|
|
368
|
+
CREATE INDEX table_module_table_id_idx ON metaschema_modules_public.table_module (table_id);
|
|
369
|
+
|
|
370
|
+
CREATE INDEX table_module_node_type_idx ON metaschema_modules_public.table_module (node_type);
|
|
371
|
+
|
|
372
|
+
CREATE TABLE metaschema_modules_public.secure_table_provision (
|
|
373
|
+
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
374
|
+
database_id uuid NOT NULL,
|
|
375
|
+
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
376
|
+
table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
377
|
+
table_name text DEFAULT NULL,
|
|
378
|
+
node_type text DEFAULT NULL,
|
|
379
|
+
use_rls boolean NOT NULL DEFAULT true,
|
|
380
|
+
node_data jsonb NOT NULL DEFAULT '{}',
|
|
381
|
+
grant_roles text[] NOT NULL DEFAULT ARRAY['authenticated'],
|
|
382
|
+
grant_privileges jsonb NOT NULL DEFAULT '[]',
|
|
383
|
+
policy_type text DEFAULT NULL,
|
|
384
|
+
policy_privileges text[] DEFAULT NULL,
|
|
385
|
+
policy_role text DEFAULT NULL,
|
|
386
|
+
policy_permissive boolean NOT NULL DEFAULT true,
|
|
387
|
+
policy_name text DEFAULT NULL,
|
|
388
|
+
policy_data jsonb NOT NULL DEFAULT '{}',
|
|
389
|
+
out_fields uuid[] DEFAULT NULL,
|
|
390
|
+
CONSTRAINT db_fkey
|
|
391
|
+
FOREIGN KEY(database_id)
|
|
392
|
+
REFERENCES metaschema_public.database (id)
|
|
393
|
+
ON DELETE CASCADE,
|
|
394
|
+
CONSTRAINT table_fkey
|
|
395
|
+
FOREIGN KEY(table_id)
|
|
396
|
+
REFERENCES metaschema_public."table" (id)
|
|
397
|
+
ON DELETE CASCADE,
|
|
398
|
+
CONSTRAINT schema_fkey
|
|
399
|
+
FOREIGN KEY(schema_id)
|
|
400
|
+
REFERENCES metaschema_public.schema (id)
|
|
401
|
+
ON DELETE CASCADE
|
|
402
|
+
);
|
|
403
|
+
|
|
404
|
+
COMMENT ON TABLE metaschema_modules_public.secure_table_provision IS 'Provisions security, fields, grants, and policies onto a table. Each row can independently: (1) create fields via node_type, (2) grant privileges via grant_privileges, (3) create RLS policies via policy_type. Multiple rows can target the same table to compose different concerns. All three concerns are optional and independent.';
|
|
405
|
+
|
|
406
|
+
COMMENT ON COLUMN metaschema_modules_public.secure_table_provision.id IS 'Unique identifier for this provision row.';
|
|
407
|
+
|
|
408
|
+
COMMENT ON COLUMN metaschema_modules_public.secure_table_provision.database_id IS 'The database this provision belongs to. Required.';
|
|
409
|
+
|
|
410
|
+
COMMENT ON COLUMN metaschema_modules_public.secure_table_provision.schema_id IS 'Target schema for the table. Defaults to uuid_nil(); the trigger resolves this to the app_public schema if not explicitly provided.';
|
|
411
|
+
|
|
412
|
+
COMMENT ON COLUMN metaschema_modules_public.secure_table_provision.table_id IS 'Target table to provision. Defaults to uuid_nil(); the trigger creates or resolves the table via table_name if not explicitly provided.';
|
|
413
|
+
|
|
414
|
+
COMMENT ON COLUMN metaschema_modules_public.secure_table_provision.table_name IS 'Name of the target table. Used to create or look up the table when table_id is not provided. If omitted, it is backfilled from the resolved table.';
|
|
415
|
+
|
|
416
|
+
COMMENT ON COLUMN metaschema_modules_public.secure_table_provision.node_type IS 'Which generator to invoke for field creation. One of: DataId, DataDirectOwner, DataEntityMembership, DataOwnershipInEntity, DataTimestamps, DataPeoplestamps, DataPublishable, DataSoftDelete. NULL means no field creation — the row only provisions grants and/or policies.';
|
|
417
|
+
|
|
418
|
+
COMMENT ON COLUMN metaschema_modules_public.secure_table_provision.use_rls IS 'If true and Row Level Security is not yet enabled on the target table, enable it. Automatically set to true by the trigger when policy_type is provided. Defaults to true.';
|
|
419
|
+
|
|
420
|
+
COMMENT ON COLUMN metaschema_modules_public.secure_table_provision.node_data IS 'Configuration passed to the generator function for field creation (only used when node_type is set). Known keys include: field_name (text, default ''id'') for DataId, owner_field_name (text, default ''owner_id'') for DataDirectOwner/DataOwnershipInEntity, entity_field_name (text, default ''entity_id'') for DataEntityMembership/DataOwnershipInEntity, include_id (boolean, default true) for most node_types, include_user_fk (boolean, default true) to add FK to users table. Defaults to ''{}''.';
|
|
421
|
+
|
|
422
|
+
COMMENT ON COLUMN metaschema_modules_public.secure_table_provision.grant_roles IS 'Database roles to grant privileges to. Supports multiple roles, e.g. ARRAY[''authenticated'', ''admin'']. Each role receives all privileges defined in grant_privileges. Defaults to ARRAY[''authenticated''].';
|
|
423
|
+
|
|
424
|
+
COMMENT ON COLUMN metaschema_modules_public.secure_table_provision.grant_privileges IS 'Array of [privilege, columns] tuples defining table grants. Examples: [["select","*"],["insert","*"]] for full access, or [["update",["name","bio"]]] for column-level grants. "*" means all columns; an array means column-level grant. Defaults to ''[]'' (no grants). The trigger validates this is a proper jsonb array.';
|
|
425
|
+
|
|
426
|
+
COMMENT ON COLUMN metaschema_modules_public.secure_table_provision.policy_type IS 'Policy generator type, e.g. ''AuthzEntityMembership'', ''AuthzMembership'', ''AuthzAllowAll''. NULL means no policy is created. When set, the trigger automatically enables RLS on the target table.';
|
|
427
|
+
|
|
428
|
+
COMMENT ON COLUMN metaschema_modules_public.secure_table_provision.policy_privileges IS 'Privileges the policy applies to, e.g. ARRAY[''select'',''update'']. NULL means privileges are derived from the grant_privileges verbs.';
|
|
429
|
+
|
|
430
|
+
COMMENT ON COLUMN metaschema_modules_public.secure_table_provision.policy_role IS 'Role the policy targets. NULL means it falls back to the first role in grant_roles.';
|
|
431
|
+
|
|
432
|
+
COMMENT ON COLUMN metaschema_modules_public.secure_table_provision.policy_permissive IS 'Whether the policy is PERMISSIVE (true) or RESTRICTIVE (false). Defaults to true.';
|
|
433
|
+
|
|
434
|
+
COMMENT ON COLUMN metaschema_modules_public.secure_table_provision.policy_name IS 'Custom suffix for the generated policy name. When NULL and policy_type is set, the trigger auto-derives a suffix from policy_type by stripping the Authz prefix and underscoring the remainder (e.g. AuthzDirectOwner becomes direct_owner, producing policy names like auth_sel_direct_owner). When explicitly set, the value is passed through as-is to metaschema.create_policy name parameter. This ensures multiple policies on the same table do not collide (e.g. AuthzDirectOwner + AuthzPublishable each get unique names).';
|
|
435
|
+
|
|
436
|
+
COMMENT ON COLUMN metaschema_modules_public.secure_table_provision.policy_data IS 'Opaque configuration passed through to metaschema.create_policy(). Structure varies by policy_type and is not interpreted by this trigger. Defaults to ''{}''.';
|
|
437
|
+
|
|
438
|
+
COMMENT ON COLUMN metaschema_modules_public.secure_table_provision.out_fields IS 'Output column populated by the trigger after field creation. Contains the UUIDs of the metaschema fields created on the target table by this provision row''s generator. NULL when node_type is NULL or before the trigger runs. Callers should not set this directly.';
|
|
439
|
+
|
|
440
|
+
COMMENT ON CONSTRAINT schema_fkey ON metaschema_modules_public.secure_table_provision IS '@omit manyToMany';
|
|
441
|
+
|
|
442
|
+
COMMENT ON CONSTRAINT table_fkey ON metaschema_modules_public.secure_table_provision IS '@omit manyToMany';
|
|
443
|
+
|
|
444
|
+
COMMENT ON CONSTRAINT db_fkey ON metaschema_modules_public.secure_table_provision IS '@omit manyToMany';
|
|
445
|
+
|
|
446
|
+
CREATE INDEX secure_table_provision_database_id_idx ON metaschema_modules_public.secure_table_provision (database_id);
|
|
447
|
+
|
|
448
|
+
CREATE INDEX secure_table_provision_table_id_idx ON metaschema_modules_public.secure_table_provision (table_id);
|
|
449
|
+
|
|
450
|
+
CREATE INDEX secure_table_provision_node_type_idx ON metaschema_modules_public.secure_table_provision (node_type);
|
|
451
|
+
|
|
452
|
+
CREATE FUNCTION metaschema_modules_private.tg_set_secure_table_provision_deterministic_id() RETURNS trigger AS $EOFCODE$
|
|
453
|
+
BEGIN
|
|
454
|
+
IF current_setting('metaschema.deterministic_ids', true) = 'true' THEN
|
|
455
|
+
NEW.id := metaschema_private.deterministic_id(NEW.table_id, NEW.node_type);
|
|
456
|
+
END IF;
|
|
457
|
+
RETURN NEW;
|
|
458
|
+
END;
|
|
459
|
+
$EOFCODE$ LANGUAGE plpgsql;
|
|
460
|
+
|
|
461
|
+
CREATE TRIGGER zzz_set_deterministic_id
|
|
462
|
+
BEFORE INSERT
|
|
463
|
+
ON metaschema_modules_public.secure_table_provision
|
|
464
|
+
FOR EACH ROW
|
|
465
|
+
EXECUTE PROCEDURE metaschema_modules_private.tg_set_secure_table_provision_deterministic_id();
|
|
466
|
+
|
|
467
|
+
ALTER TABLE metaschema_modules_public.secure_table_provision
|
|
468
|
+
ENABLE ALWAYS TRIGGER zzz_set_deterministic_id;
|
|
469
|
+
|
|
326
470
|
CREATE TABLE metaschema_modules_public.invites_module (
|
|
327
471
|
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
328
472
|
database_id uuid NOT NULL,
|
|
@@ -344,23 +488,23 @@ CREATE TABLE metaschema_modules_public.invites_module (
|
|
|
344
488
|
ON DELETE CASCADE,
|
|
345
489
|
CONSTRAINT invites_table_fkey
|
|
346
490
|
FOREIGN KEY(invites_table_id)
|
|
347
|
-
REFERENCES metaschema_public.table (id)
|
|
491
|
+
REFERENCES metaschema_public."table" (id)
|
|
348
492
|
ON DELETE CASCADE,
|
|
349
493
|
CONSTRAINT emails_table_fkey
|
|
350
494
|
FOREIGN KEY(emails_table_id)
|
|
351
|
-
REFERENCES metaschema_public.table (id)
|
|
495
|
+
REFERENCES metaschema_public."table" (id)
|
|
352
496
|
ON DELETE CASCADE,
|
|
353
497
|
CONSTRAINT users_table_fkey
|
|
354
498
|
FOREIGN KEY(users_table_id)
|
|
355
|
-
REFERENCES metaschema_public.table (id)
|
|
499
|
+
REFERENCES metaschema_public."table" (id)
|
|
356
500
|
ON DELETE CASCADE,
|
|
357
501
|
CONSTRAINT entity_table_fkey
|
|
358
502
|
FOREIGN KEY(entity_table_id)
|
|
359
|
-
REFERENCES metaschema_public.table (id)
|
|
503
|
+
REFERENCES metaschema_public."table" (id)
|
|
360
504
|
ON DELETE CASCADE,
|
|
361
505
|
CONSTRAINT claimed_invites_table_fkey
|
|
362
506
|
FOREIGN KEY(claimed_invites_table_id)
|
|
363
|
-
REFERENCES metaschema_public.table (id)
|
|
507
|
+
REFERENCES metaschema_public."table" (id)
|
|
364
508
|
ON DELETE CASCADE,
|
|
365
509
|
CONSTRAINT schema_fkey
|
|
366
510
|
FOREIGN KEY(schema_id)
|
|
@@ -429,27 +573,27 @@ CREATE TABLE metaschema_modules_public.levels_module (
|
|
|
429
573
|
ON DELETE CASCADE,
|
|
430
574
|
CONSTRAINT steps_table_fkey
|
|
431
575
|
FOREIGN KEY(steps_table_id)
|
|
432
|
-
REFERENCES metaschema_public.table (id)
|
|
576
|
+
REFERENCES metaschema_public."table" (id)
|
|
433
577
|
ON DELETE CASCADE,
|
|
434
578
|
CONSTRAINT achievements_table_fkey
|
|
435
579
|
FOREIGN KEY(achievements_table_id)
|
|
436
|
-
REFERENCES metaschema_public.table (id)
|
|
580
|
+
REFERENCES metaschema_public."table" (id)
|
|
437
581
|
ON DELETE CASCADE,
|
|
438
582
|
CONSTRAINT levels_table_fkey
|
|
439
583
|
FOREIGN KEY(levels_table_id)
|
|
440
|
-
REFERENCES metaschema_public.table (id)
|
|
584
|
+
REFERENCES metaschema_public."table" (id)
|
|
441
585
|
ON DELETE CASCADE,
|
|
442
586
|
CONSTRAINT level_requirements_table_fkey
|
|
443
587
|
FOREIGN KEY(level_requirements_table_id)
|
|
444
|
-
REFERENCES metaschema_public.table (id)
|
|
588
|
+
REFERENCES metaschema_public."table" (id)
|
|
445
589
|
ON DELETE CASCADE,
|
|
446
590
|
CONSTRAINT entity_table_fkey
|
|
447
591
|
FOREIGN KEY(entity_table_id)
|
|
448
|
-
REFERENCES metaschema_public.table (id)
|
|
592
|
+
REFERENCES metaschema_public."table" (id)
|
|
449
593
|
ON DELETE CASCADE,
|
|
450
594
|
CONSTRAINT actor_table_fkey
|
|
451
595
|
FOREIGN KEY(actor_table_id)
|
|
452
|
-
REFERENCES metaschema_public.table (id)
|
|
596
|
+
REFERENCES metaschema_public."table" (id)
|
|
453
597
|
ON DELETE CASCADE
|
|
454
598
|
);
|
|
455
599
|
|
|
@@ -502,19 +646,19 @@ CREATE TABLE metaschema_modules_public.limits_module (
|
|
|
502
646
|
ON DELETE CASCADE,
|
|
503
647
|
CONSTRAINT table_fkey
|
|
504
648
|
FOREIGN KEY(table_id)
|
|
505
|
-
REFERENCES metaschema_public.table (id)
|
|
649
|
+
REFERENCES metaschema_public."table" (id)
|
|
506
650
|
ON DELETE CASCADE,
|
|
507
651
|
CONSTRAINT default_table_fkey
|
|
508
652
|
FOREIGN KEY(default_table_id)
|
|
509
|
-
REFERENCES metaschema_public.table (id)
|
|
653
|
+
REFERENCES metaschema_public."table" (id)
|
|
510
654
|
ON DELETE CASCADE,
|
|
511
655
|
CONSTRAINT entity_table_fkey
|
|
512
656
|
FOREIGN KEY(entity_table_id)
|
|
513
|
-
REFERENCES metaschema_public.table (id)
|
|
657
|
+
REFERENCES metaschema_public."table" (id)
|
|
514
658
|
ON DELETE CASCADE,
|
|
515
659
|
CONSTRAINT actor_table_fkey
|
|
516
660
|
FOREIGN KEY(actor_table_id)
|
|
517
|
-
REFERENCES metaschema_public.table (id)
|
|
661
|
+
REFERENCES metaschema_public."table" (id)
|
|
518
662
|
ON DELETE CASCADE
|
|
519
663
|
);
|
|
520
664
|
|
|
@@ -548,7 +692,7 @@ CREATE TABLE metaschema_modules_public.membership_types_module (
|
|
|
548
692
|
ON DELETE CASCADE,
|
|
549
693
|
CONSTRAINT table_fkey
|
|
550
694
|
FOREIGN KEY(table_id)
|
|
551
|
-
REFERENCES metaschema_public.table (id)
|
|
695
|
+
REFERENCES metaschema_public."table" (id)
|
|
552
696
|
ON DELETE CASCADE
|
|
553
697
|
);
|
|
554
698
|
|
|
@@ -606,27 +750,27 @@ CREATE TABLE metaschema_modules_public.memberships_module (
|
|
|
606
750
|
ON DELETE CASCADE,
|
|
607
751
|
CONSTRAINT memberships_table_fkey
|
|
608
752
|
FOREIGN KEY(memberships_table_id)
|
|
609
|
-
REFERENCES metaschema_public.table (id)
|
|
753
|
+
REFERENCES metaschema_public."table" (id)
|
|
610
754
|
ON DELETE CASCADE,
|
|
611
755
|
CONSTRAINT membership_defaults_table_fkey
|
|
612
756
|
FOREIGN KEY(membership_defaults_table_id)
|
|
613
|
-
REFERENCES metaschema_public.table (id)
|
|
757
|
+
REFERENCES metaschema_public."table" (id)
|
|
614
758
|
ON DELETE CASCADE,
|
|
615
759
|
CONSTRAINT members_table_fkey
|
|
616
760
|
FOREIGN KEY(members_table_id)
|
|
617
|
-
REFERENCES metaschema_public.table (id)
|
|
761
|
+
REFERENCES metaschema_public."table" (id)
|
|
618
762
|
ON DELETE CASCADE,
|
|
619
763
|
CONSTRAINT grants_table_fkey
|
|
620
764
|
FOREIGN KEY(grants_table_id)
|
|
621
|
-
REFERENCES metaschema_public.table (id)
|
|
765
|
+
REFERENCES metaschema_public."table" (id)
|
|
622
766
|
ON DELETE CASCADE,
|
|
623
767
|
CONSTRAINT sprt_table_fkey
|
|
624
768
|
FOREIGN KEY(sprt_table_id)
|
|
625
|
-
REFERENCES metaschema_public.table (id)
|
|
769
|
+
REFERENCES metaschema_public."table" (id)
|
|
626
770
|
ON DELETE CASCADE,
|
|
627
771
|
CONSTRAINT entity_table_fkey
|
|
628
772
|
FOREIGN KEY(entity_table_id)
|
|
629
|
-
REFERENCES metaschema_public.table (id)
|
|
773
|
+
REFERENCES metaschema_public."table" (id)
|
|
630
774
|
ON DELETE CASCADE,
|
|
631
775
|
CONSTRAINT entity_table_owner_fkey
|
|
632
776
|
FOREIGN KEY(entity_table_owner_id)
|
|
@@ -634,23 +778,23 @@ CREATE TABLE metaschema_modules_public.memberships_module (
|
|
|
634
778
|
ON DELETE CASCADE,
|
|
635
779
|
CONSTRAINT actor_table_fkey
|
|
636
780
|
FOREIGN KEY(actor_table_id)
|
|
637
|
-
REFERENCES metaschema_public.table (id)
|
|
781
|
+
REFERENCES metaschema_public."table" (id)
|
|
638
782
|
ON DELETE CASCADE,
|
|
639
783
|
CONSTRAINT limits_table_fkey
|
|
640
784
|
FOREIGN KEY(limits_table_id)
|
|
641
|
-
REFERENCES metaschema_public.table (id)
|
|
785
|
+
REFERENCES metaschema_public."table" (id)
|
|
642
786
|
ON DELETE CASCADE,
|
|
643
787
|
CONSTRAINT default_limits_table_fkey
|
|
644
788
|
FOREIGN KEY(default_limits_table_id)
|
|
645
|
-
REFERENCES metaschema_public.table (id)
|
|
789
|
+
REFERENCES metaschema_public."table" (id)
|
|
646
790
|
ON DELETE CASCADE,
|
|
647
791
|
CONSTRAINT permissions_table_fkey
|
|
648
792
|
FOREIGN KEY(permissions_table_id)
|
|
649
|
-
REFERENCES metaschema_public.table (id)
|
|
793
|
+
REFERENCES metaschema_public."table" (id)
|
|
650
794
|
ON DELETE CASCADE,
|
|
651
795
|
CONSTRAINT default_permissions_table_fkey
|
|
652
796
|
FOREIGN KEY(default_permissions_table_id)
|
|
653
|
-
REFERENCES metaschema_public.table (id)
|
|
797
|
+
REFERENCES metaschema_public."table" (id)
|
|
654
798
|
ON DELETE CASCADE
|
|
655
799
|
);
|
|
656
800
|
|
|
@@ -718,19 +862,19 @@ CREATE TABLE metaschema_modules_public.permissions_module (
|
|
|
718
862
|
ON DELETE CASCADE,
|
|
719
863
|
CONSTRAINT table_fkey
|
|
720
864
|
FOREIGN KEY(table_id)
|
|
721
|
-
REFERENCES metaschema_public.table (id)
|
|
865
|
+
REFERENCES metaschema_public."table" (id)
|
|
722
866
|
ON DELETE CASCADE,
|
|
723
867
|
CONSTRAINT default_table_fkey
|
|
724
868
|
FOREIGN KEY(default_table_id)
|
|
725
|
-
REFERENCES metaschema_public.table (id)
|
|
869
|
+
REFERENCES metaschema_public."table" (id)
|
|
726
870
|
ON DELETE CASCADE,
|
|
727
871
|
CONSTRAINT entity_table_fkey
|
|
728
872
|
FOREIGN KEY(entity_table_id)
|
|
729
|
-
REFERENCES metaschema_public.table (id)
|
|
873
|
+
REFERENCES metaschema_public."table" (id)
|
|
730
874
|
ON DELETE CASCADE,
|
|
731
875
|
CONSTRAINT actor_table_fkey
|
|
732
876
|
FOREIGN KEY(actor_table_id)
|
|
733
|
-
REFERENCES metaschema_public.table (id)
|
|
877
|
+
REFERENCES metaschema_public."table" (id)
|
|
734
878
|
ON DELETE CASCADE
|
|
735
879
|
);
|
|
736
880
|
|
|
@@ -762,11 +906,11 @@ CREATE TABLE metaschema_modules_public.phone_numbers_module (
|
|
|
762
906
|
ON DELETE CASCADE,
|
|
763
907
|
CONSTRAINT table_fkey
|
|
764
908
|
FOREIGN KEY(table_id)
|
|
765
|
-
REFERENCES metaschema_public.table (id)
|
|
909
|
+
REFERENCES metaschema_public."table" (id)
|
|
766
910
|
ON DELETE CASCADE,
|
|
767
911
|
CONSTRAINT owner_table_fkey
|
|
768
912
|
FOREIGN KEY(owner_table_id)
|
|
769
|
-
REFERENCES metaschema_public.table (id)
|
|
913
|
+
REFERENCES metaschema_public."table" (id)
|
|
770
914
|
ON DELETE CASCADE,
|
|
771
915
|
CONSTRAINT schema_fkey
|
|
772
916
|
FOREIGN KEY(schema_id)
|
|
@@ -803,7 +947,6 @@ CREATE TABLE metaschema_modules_public.profiles_module (
|
|
|
803
947
|
profile_grants_table_name text NOT NULL DEFAULT '',
|
|
804
948
|
profile_definition_grants_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
805
949
|
profile_definition_grants_table_name text NOT NULL DEFAULT '',
|
|
806
|
-
bitlen int NOT NULL DEFAULT 24,
|
|
807
950
|
membership_type int NOT NULL,
|
|
808
951
|
entity_table_id uuid NULL,
|
|
809
952
|
actor_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
@@ -824,35 +967,35 @@ CREATE TABLE metaschema_modules_public.profiles_module (
|
|
|
824
967
|
ON DELETE CASCADE,
|
|
825
968
|
CONSTRAINT table_fkey
|
|
826
969
|
FOREIGN KEY(table_id)
|
|
827
|
-
REFERENCES metaschema_public.table (id)
|
|
970
|
+
REFERENCES metaschema_public."table" (id)
|
|
828
971
|
ON DELETE CASCADE,
|
|
829
972
|
CONSTRAINT profile_permissions_table_fkey
|
|
830
973
|
FOREIGN KEY(profile_permissions_table_id)
|
|
831
|
-
REFERENCES metaschema_public.table (id)
|
|
974
|
+
REFERENCES metaschema_public."table" (id)
|
|
832
975
|
ON DELETE CASCADE,
|
|
833
976
|
CONSTRAINT profile_grants_table_fkey
|
|
834
977
|
FOREIGN KEY(profile_grants_table_id)
|
|
835
|
-
REFERENCES metaschema_public.table (id)
|
|
978
|
+
REFERENCES metaschema_public."table" (id)
|
|
836
979
|
ON DELETE CASCADE,
|
|
837
980
|
CONSTRAINT profile_definition_grants_table_fkey
|
|
838
981
|
FOREIGN KEY(profile_definition_grants_table_id)
|
|
839
|
-
REFERENCES metaschema_public.table (id)
|
|
982
|
+
REFERENCES metaschema_public."table" (id)
|
|
840
983
|
ON DELETE CASCADE,
|
|
841
984
|
CONSTRAINT entity_table_fkey
|
|
842
985
|
FOREIGN KEY(entity_table_id)
|
|
843
|
-
REFERENCES metaschema_public.table (id)
|
|
986
|
+
REFERENCES metaschema_public."table" (id)
|
|
844
987
|
ON DELETE CASCADE,
|
|
845
988
|
CONSTRAINT actor_table_fkey
|
|
846
989
|
FOREIGN KEY(actor_table_id)
|
|
847
|
-
REFERENCES metaschema_public.table (id)
|
|
990
|
+
REFERENCES metaschema_public."table" (id)
|
|
848
991
|
ON DELETE CASCADE,
|
|
849
992
|
CONSTRAINT permissions_table_fkey
|
|
850
993
|
FOREIGN KEY(permissions_table_id)
|
|
851
|
-
REFERENCES metaschema_public.table (id)
|
|
994
|
+
REFERENCES metaschema_public."table" (id)
|
|
852
995
|
ON DELETE CASCADE,
|
|
853
996
|
CONSTRAINT memberships_table_fkey
|
|
854
997
|
FOREIGN KEY(memberships_table_id)
|
|
855
|
-
REFERENCES metaschema_public.table (id)
|
|
998
|
+
REFERENCES metaschema_public."table" (id)
|
|
856
999
|
ON DELETE CASCADE,
|
|
857
1000
|
CONSTRAINT profiles_module_unique
|
|
858
1001
|
UNIQUE (database_id, membership_type)
|
|
@@ -888,7 +1031,8 @@ CREATE TABLE metaschema_modules_public.rls_module (
|
|
|
888
1031
|
api_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
889
1032
|
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
890
1033
|
private_schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
891
|
-
|
|
1034
|
+
session_credentials_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
1035
|
+
sessions_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
892
1036
|
users_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
893
1037
|
authenticate text NOT NULL DEFAULT 'authenticate',
|
|
894
1038
|
authenticate_strict text NOT NULL DEFAULT 'authenticate_strict',
|
|
@@ -902,13 +1046,17 @@ CREATE TABLE metaschema_modules_public.rls_module (
|
|
|
902
1046
|
FOREIGN KEY(api_id)
|
|
903
1047
|
REFERENCES services_public.apis (id)
|
|
904
1048
|
ON DELETE CASCADE,
|
|
905
|
-
CONSTRAINT
|
|
906
|
-
FOREIGN KEY(
|
|
907
|
-
REFERENCES metaschema_public.table (id)
|
|
1049
|
+
CONSTRAINT session_credentials_table_fkey
|
|
1050
|
+
FOREIGN KEY(session_credentials_table_id)
|
|
1051
|
+
REFERENCES metaschema_public."table" (id)
|
|
1052
|
+
ON DELETE CASCADE,
|
|
1053
|
+
CONSTRAINT sessions_table_fkey
|
|
1054
|
+
FOREIGN KEY(sessions_table_id)
|
|
1055
|
+
REFERENCES metaschema_public."table" (id)
|
|
908
1056
|
ON DELETE CASCADE,
|
|
909
1057
|
CONSTRAINT users_table_fkey
|
|
910
1058
|
FOREIGN KEY(users_table_id)
|
|
911
|
-
REFERENCES metaschema_public.table (id)
|
|
1059
|
+
REFERENCES metaschema_public."table" (id)
|
|
912
1060
|
ON DELETE CASCADE,
|
|
913
1061
|
CONSTRAINT schema_fkey
|
|
914
1062
|
FOREIGN KEY(schema_id)
|
|
@@ -930,7 +1078,9 @@ COMMENT ON CONSTRAINT pschema_fkey ON metaschema_modules_public.rls_module IS '@
|
|
|
930
1078
|
|
|
931
1079
|
COMMENT ON CONSTRAINT db_fkey ON metaschema_modules_public.rls_module IS '@omit';
|
|
932
1080
|
|
|
933
|
-
COMMENT ON CONSTRAINT
|
|
1081
|
+
COMMENT ON CONSTRAINT session_credentials_table_fkey ON metaschema_modules_public.rls_module IS '@omit';
|
|
1082
|
+
|
|
1083
|
+
COMMENT ON CONSTRAINT sessions_table_fkey ON metaschema_modules_public.rls_module IS '@omit';
|
|
934
1084
|
|
|
935
1085
|
COMMENT ON CONSTRAINT users_table_fkey ON metaschema_modules_public.rls_module IS '@omit';
|
|
936
1086
|
|
|
@@ -952,7 +1102,7 @@ CREATE TABLE metaschema_modules_public.secrets_module (
|
|
|
952
1102
|
ON DELETE CASCADE,
|
|
953
1103
|
CONSTRAINT table_fkey
|
|
954
1104
|
FOREIGN KEY(table_id)
|
|
955
|
-
REFERENCES metaschema_public.table (id)
|
|
1105
|
+
REFERENCES metaschema_public."table" (id)
|
|
956
1106
|
ON DELETE CASCADE
|
|
957
1107
|
);
|
|
958
1108
|
|
|
@@ -964,14 +1114,18 @@ CREATE INDEX secrets_module_database_id_idx ON metaschema_modules_public.secrets
|
|
|
964
1114
|
|
|
965
1115
|
COMMENT ON CONSTRAINT table_fkey ON metaschema_modules_public.secrets_module IS '@omit manyToMany';
|
|
966
1116
|
|
|
967
|
-
CREATE TABLE metaschema_modules_public.
|
|
1117
|
+
CREATE TABLE metaschema_modules_public.sessions_module (
|
|
968
1118
|
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
969
1119
|
database_id uuid NOT NULL,
|
|
970
1120
|
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
1121
|
+
sessions_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
1122
|
+
session_credentials_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
1123
|
+
auth_settings_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
1124
|
+
users_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
1125
|
+
sessions_default_expiration interval NOT NULL DEFAULT '30 days'::interval,
|
|
1126
|
+
sessions_table text NOT NULL DEFAULT 'sessions',
|
|
1127
|
+
session_credentials_table text NOT NULL DEFAULT 'session_credentials',
|
|
1128
|
+
auth_settings_table text NOT NULL DEFAULT 'app_auth_settings',
|
|
975
1129
|
CONSTRAINT db_fkey
|
|
976
1130
|
FOREIGN KEY(database_id)
|
|
977
1131
|
REFERENCES metaschema_public.database (id)
|
|
@@ -980,25 +1134,40 @@ CREATE TABLE metaschema_modules_public.tokens_module (
|
|
|
980
1134
|
FOREIGN KEY(schema_id)
|
|
981
1135
|
REFERENCES metaschema_public.schema (id)
|
|
982
1136
|
ON DELETE CASCADE,
|
|
983
|
-
CONSTRAINT
|
|
984
|
-
FOREIGN KEY(
|
|
985
|
-
REFERENCES metaschema_public.table (id)
|
|
1137
|
+
CONSTRAINT sessions_table_fkey
|
|
1138
|
+
FOREIGN KEY(sessions_table_id)
|
|
1139
|
+
REFERENCES metaschema_public."table" (id)
|
|
1140
|
+
ON DELETE CASCADE,
|
|
1141
|
+
CONSTRAINT session_credentials_table_fkey
|
|
1142
|
+
FOREIGN KEY(session_credentials_table_id)
|
|
1143
|
+
REFERENCES metaschema_public."table" (id)
|
|
986
1144
|
ON DELETE CASCADE,
|
|
987
|
-
CONSTRAINT
|
|
988
|
-
FOREIGN KEY(
|
|
989
|
-
REFERENCES metaschema_public.table (id)
|
|
1145
|
+
CONSTRAINT auth_settings_table_fkey
|
|
1146
|
+
FOREIGN KEY(auth_settings_table_id)
|
|
1147
|
+
REFERENCES metaschema_public."table" (id)
|
|
1148
|
+
ON DELETE CASCADE,
|
|
1149
|
+
CONSTRAINT users_table_fkey
|
|
1150
|
+
FOREIGN KEY(users_table_id)
|
|
1151
|
+
REFERENCES metaschema_public."table" (id)
|
|
990
1152
|
ON DELETE CASCADE
|
|
991
1153
|
);
|
|
992
1154
|
|
|
993
|
-
COMMENT ON CONSTRAINT schema_fkey ON metaschema_modules_public.
|
|
1155
|
+
COMMENT ON CONSTRAINT schema_fkey ON metaschema_modules_public.sessions_module IS '@omit manyToMany';
|
|
1156
|
+
|
|
1157
|
+
COMMENT ON CONSTRAINT db_fkey ON metaschema_modules_public.sessions_module IS '@omit manyToMany';
|
|
994
1158
|
|
|
995
|
-
|
|
1159
|
+
CREATE INDEX sessions_module_database_id_idx ON metaschema_modules_public.sessions_module (database_id);
|
|
996
1160
|
|
|
997
|
-
|
|
1161
|
+
COMMENT ON CONSTRAINT sessions_table_fkey ON metaschema_modules_public.sessions_module IS '@fieldName sessionsTableBySessionsTableId
|
|
1162
|
+
@omit manyToMany';
|
|
998
1163
|
|
|
999
|
-
COMMENT ON CONSTRAINT
|
|
1164
|
+
COMMENT ON CONSTRAINT session_credentials_table_fkey ON metaschema_modules_public.sessions_module IS '@fieldName sessionCredentialsTableBySessionCredentialsTableId
|
|
1165
|
+
@omit manyToMany';
|
|
1000
1166
|
|
|
1001
|
-
COMMENT ON CONSTRAINT
|
|
1167
|
+
COMMENT ON CONSTRAINT auth_settings_table_fkey ON metaschema_modules_public.sessions_module IS '@fieldName authSettingsTableByAuthSettingsTableId
|
|
1168
|
+
@omit manyToMany';
|
|
1169
|
+
|
|
1170
|
+
COMMENT ON CONSTRAINT users_table_fkey ON metaschema_modules_public.sessions_module IS '@omit manyToMany';
|
|
1002
1171
|
|
|
1003
1172
|
CREATE TABLE metaschema_modules_public.user_auth_module (
|
|
1004
1173
|
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
@@ -1008,7 +1177,8 @@ CREATE TABLE metaschema_modules_public.user_auth_module (
|
|
|
1008
1177
|
users_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
1009
1178
|
secrets_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
1010
1179
|
encrypted_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
1011
|
-
|
|
1180
|
+
sessions_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
1181
|
+
session_credentials_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
1012
1182
|
audits_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
1013
1183
|
audits_table_name text NOT NULL DEFAULT 'audit_logs',
|
|
1014
1184
|
sign_in_function text NOT NULL DEFAULT 'sign_in',
|
|
@@ -1036,23 +1206,27 @@ CREATE TABLE metaschema_modules_public.user_auth_module (
|
|
|
1036
1206
|
ON DELETE CASCADE,
|
|
1037
1207
|
CONSTRAINT email_table_fkey
|
|
1038
1208
|
FOREIGN KEY(emails_table_id)
|
|
1039
|
-
REFERENCES metaschema_public.table (id)
|
|
1209
|
+
REFERENCES metaschema_public."table" (id)
|
|
1040
1210
|
ON DELETE CASCADE,
|
|
1041
1211
|
CONSTRAINT users_table_fkey
|
|
1042
1212
|
FOREIGN KEY(users_table_id)
|
|
1043
|
-
REFERENCES metaschema_public.table (id)
|
|
1213
|
+
REFERENCES metaschema_public."table" (id)
|
|
1044
1214
|
ON DELETE CASCADE,
|
|
1045
1215
|
CONSTRAINT secrets_table_fkey
|
|
1046
1216
|
FOREIGN KEY(secrets_table_id)
|
|
1047
|
-
REFERENCES metaschema_public.table (id)
|
|
1217
|
+
REFERENCES metaschema_public."table" (id)
|
|
1048
1218
|
ON DELETE CASCADE,
|
|
1049
1219
|
CONSTRAINT encrypted_table_fkey
|
|
1050
1220
|
FOREIGN KEY(encrypted_table_id)
|
|
1051
|
-
REFERENCES metaschema_public.table (id)
|
|
1221
|
+
REFERENCES metaschema_public."table" (id)
|
|
1222
|
+
ON DELETE CASCADE,
|
|
1223
|
+
CONSTRAINT sessions_table_fkey
|
|
1224
|
+
FOREIGN KEY(sessions_table_id)
|
|
1225
|
+
REFERENCES metaschema_public."table" (id)
|
|
1052
1226
|
ON DELETE CASCADE,
|
|
1053
|
-
CONSTRAINT
|
|
1054
|
-
FOREIGN KEY(
|
|
1055
|
-
REFERENCES metaschema_public.table (id)
|
|
1227
|
+
CONSTRAINT session_credentials_table_fkey
|
|
1228
|
+
FOREIGN KEY(session_credentials_table_id)
|
|
1229
|
+
REFERENCES metaschema_public."table" (id)
|
|
1056
1230
|
ON DELETE CASCADE
|
|
1057
1231
|
);
|
|
1058
1232
|
|
|
@@ -1070,7 +1244,9 @@ COMMENT ON CONSTRAINT secrets_table_fkey ON metaschema_modules_public.user_auth_
|
|
|
1070
1244
|
|
|
1071
1245
|
COMMENT ON CONSTRAINT encrypted_table_fkey ON metaschema_modules_public.user_auth_module IS '@omit';
|
|
1072
1246
|
|
|
1073
|
-
COMMENT ON CONSTRAINT
|
|
1247
|
+
COMMENT ON CONSTRAINT sessions_table_fkey ON metaschema_modules_public.user_auth_module IS '@omit';
|
|
1248
|
+
|
|
1249
|
+
COMMENT ON CONSTRAINT session_credentials_table_fkey ON metaschema_modules_public.user_auth_module IS '@omit';
|
|
1074
1250
|
|
|
1075
1251
|
CREATE TABLE metaschema_modules_public.users_module (
|
|
1076
1252
|
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
@@ -1090,11 +1266,11 @@ CREATE TABLE metaschema_modules_public.users_module (
|
|
|
1090
1266
|
ON DELETE CASCADE,
|
|
1091
1267
|
CONSTRAINT table_fkey
|
|
1092
1268
|
FOREIGN KEY(table_id)
|
|
1093
|
-
REFERENCES metaschema_public.table (id)
|
|
1269
|
+
REFERENCES metaschema_public."table" (id)
|
|
1094
1270
|
ON DELETE CASCADE,
|
|
1095
1271
|
CONSTRAINT type_table_fkey
|
|
1096
1272
|
FOREIGN KEY(type_table_id)
|
|
1097
|
-
REFERENCES metaschema_public.table (id)
|
|
1273
|
+
REFERENCES metaschema_public."table" (id)
|
|
1098
1274
|
ON DELETE CASCADE
|
|
1099
1275
|
);
|
|
1100
1276
|
|
|
@@ -1165,23 +1341,23 @@ CREATE TABLE metaschema_modules_public.hierarchy_module (
|
|
|
1165
1341
|
ON DELETE CASCADE,
|
|
1166
1342
|
CONSTRAINT chart_edges_table_fkey
|
|
1167
1343
|
FOREIGN KEY(chart_edges_table_id)
|
|
1168
|
-
REFERENCES metaschema_public.table (id)
|
|
1344
|
+
REFERENCES metaschema_public."table" (id)
|
|
1169
1345
|
ON DELETE CASCADE,
|
|
1170
1346
|
CONSTRAINT hierarchy_sprt_table_fkey
|
|
1171
1347
|
FOREIGN KEY(hierarchy_sprt_table_id)
|
|
1172
|
-
REFERENCES metaschema_public.table (id)
|
|
1348
|
+
REFERENCES metaschema_public."table" (id)
|
|
1173
1349
|
ON DELETE CASCADE,
|
|
1174
1350
|
CONSTRAINT chart_edge_grants_table_fkey
|
|
1175
1351
|
FOREIGN KEY(chart_edge_grants_table_id)
|
|
1176
|
-
REFERENCES metaschema_public.table (id)
|
|
1352
|
+
REFERENCES metaschema_public."table" (id)
|
|
1177
1353
|
ON DELETE CASCADE,
|
|
1178
1354
|
CONSTRAINT entity_table_fkey
|
|
1179
1355
|
FOREIGN KEY(entity_table_id)
|
|
1180
|
-
REFERENCES metaschema_public.table (id)
|
|
1356
|
+
REFERENCES metaschema_public."table" (id)
|
|
1181
1357
|
ON DELETE CASCADE,
|
|
1182
1358
|
CONSTRAINT users_table_fkey
|
|
1183
1359
|
FOREIGN KEY(users_table_id)
|
|
1184
|
-
REFERENCES metaschema_public.table (id)
|
|
1360
|
+
REFERENCES metaschema_public."table" (id)
|
|
1185
1361
|
ON DELETE CASCADE,
|
|
1186
1362
|
CONSTRAINT hierarchy_module_database_unique
|
|
1187
1363
|
UNIQUE (database_id)
|
|
@@ -1203,4 +1379,58 @@ COMMENT ON CONSTRAINT chart_edge_grants_table_fkey ON metaschema_modules_public.
|
|
|
1203
1379
|
|
|
1204
1380
|
COMMENT ON CONSTRAINT entity_table_fkey ON metaschema_modules_public.hierarchy_module IS '@omit manyToMany';
|
|
1205
1381
|
|
|
1206
|
-
COMMENT ON CONSTRAINT users_table_fkey ON metaschema_modules_public.hierarchy_module IS '@omit manyToMany';
|
|
1382
|
+
COMMENT ON CONSTRAINT users_table_fkey ON metaschema_modules_public.hierarchy_module IS '@omit manyToMany';
|
|
1383
|
+
|
|
1384
|
+
CREATE TABLE metaschema_modules_public.table_template_module (
|
|
1385
|
+
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
1386
|
+
database_id uuid NOT NULL,
|
|
1387
|
+
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
1388
|
+
private_schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
1389
|
+
table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
1390
|
+
owner_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
1391
|
+
table_name text NOT NULL,
|
|
1392
|
+
node_type text NOT NULL,
|
|
1393
|
+
data jsonb NOT NULL DEFAULT '{}',
|
|
1394
|
+
CONSTRAINT db_fkey
|
|
1395
|
+
FOREIGN KEY(database_id)
|
|
1396
|
+
REFERENCES metaschema_public.database (id)
|
|
1397
|
+
ON DELETE CASCADE,
|
|
1398
|
+
CONSTRAINT table_fkey
|
|
1399
|
+
FOREIGN KEY(table_id)
|
|
1400
|
+
REFERENCES metaschema_public."table" (id)
|
|
1401
|
+
ON DELETE CASCADE,
|
|
1402
|
+
CONSTRAINT owner_table_fkey
|
|
1403
|
+
FOREIGN KEY(owner_table_id)
|
|
1404
|
+
REFERENCES metaschema_public."table" (id)
|
|
1405
|
+
ON DELETE CASCADE,
|
|
1406
|
+
CONSTRAINT schema_fkey
|
|
1407
|
+
FOREIGN KEY(schema_id)
|
|
1408
|
+
REFERENCES metaschema_public.schema (id)
|
|
1409
|
+
ON DELETE CASCADE,
|
|
1410
|
+
CONSTRAINT private_schema_fkey
|
|
1411
|
+
FOREIGN KEY(private_schema_id)
|
|
1412
|
+
REFERENCES metaschema_public.schema (id)
|
|
1413
|
+
ON DELETE CASCADE
|
|
1414
|
+
);
|
|
1415
|
+
|
|
1416
|
+
COMMENT ON CONSTRAINT schema_fkey ON metaschema_modules_public.table_template_module IS '@omit manyToMany';
|
|
1417
|
+
|
|
1418
|
+
COMMENT ON CONSTRAINT private_schema_fkey ON metaschema_modules_public.table_template_module IS '@omit manyToMany';
|
|
1419
|
+
|
|
1420
|
+
COMMENT ON CONSTRAINT table_fkey ON metaschema_modules_public.table_template_module IS '@omit manyToMany';
|
|
1421
|
+
|
|
1422
|
+
COMMENT ON CONSTRAINT owner_table_fkey ON metaschema_modules_public.table_template_module IS '@omit manyToMany';
|
|
1423
|
+
|
|
1424
|
+
COMMENT ON CONSTRAINT db_fkey ON metaschema_modules_public.table_template_module IS '@omit manyToMany';
|
|
1425
|
+
|
|
1426
|
+
CREATE INDEX table_template_module_database_id_idx ON metaschema_modules_public.table_template_module (database_id);
|
|
1427
|
+
|
|
1428
|
+
CREATE INDEX table_template_module_schema_id_idx ON metaschema_modules_public.table_template_module (schema_id);
|
|
1429
|
+
|
|
1430
|
+
CREATE INDEX table_template_module_private_schema_id_idx ON metaschema_modules_public.table_template_module (private_schema_id);
|
|
1431
|
+
|
|
1432
|
+
CREATE INDEX table_template_module_table_id_idx ON metaschema_modules_public.table_template_module (table_id);
|
|
1433
|
+
|
|
1434
|
+
CREATE INDEX table_template_module_owner_table_id_idx ON metaschema_modules_public.table_template_module (owner_table_id);
|
|
1435
|
+
|
|
1436
|
+
CREATE INDEX table_template_module_node_type_idx ON metaschema_modules_public.table_template_module (node_type);
|