@pgpm/metaschema-modules 0.23.0 → 0.26.1
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/Makefile +1 -1
- package/README.md +1 -1
- package/deploy/schemas/metaschema_modules_public/tables/agent_module/table.sql +77 -0
- package/deploy/schemas/metaschema_modules_public/tables/billing_module/table.sql +10 -0
- package/deploy/schemas/metaschema_modules_public/tables/compute_log_module/table.sql +44 -0
- package/deploy/schemas/metaschema_modules_public/tables/config_secrets_org_module/table.sql +28 -0
- package/deploy/schemas/metaschema_modules_public/tables/{encrypted_secrets_module → config_secrets_user_module}/table.sql +4 -4
- package/deploy/schemas/metaschema_modules_public/tables/db_usage_module/table.sql +52 -0
- package/deploy/schemas/metaschema_modules_public/tables/entity_type_provision/table.sql +135 -49
- package/deploy/schemas/metaschema_modules_public/tables/events_module/table.sql +85 -0
- package/deploy/schemas/metaschema_modules_public/tables/function_module/table.sql +68 -0
- package/deploy/schemas/metaschema_modules_public/tables/graph_module/table.sql +73 -0
- package/deploy/schemas/metaschema_modules_public/tables/inference_log_module/table.sql +44 -0
- package/deploy/schemas/metaschema_modules_public/tables/limits_module/table.sql +11 -1
- package/deploy/schemas/metaschema_modules_public/tables/merkle_store_module/table.sql +50 -0
- package/deploy/schemas/metaschema_modules_public/tables/namespace_module/table.sql +65 -0
- package/deploy/schemas/metaschema_modules_public/tables/rate_limit_meters_module/table.sql +51 -0
- package/deploy/schemas/metaschema_modules_public/tables/realtime_module/table.sql +2 -2
- package/deploy/schemas/metaschema_modules_public/tables/storage_log_module/table.sql +44 -0
- package/deploy/schemas/metaschema_modules_public/tables/storage_module/table.sql +17 -9
- package/deploy/schemas/metaschema_modules_public/tables/transfer_log_module/table.sql +44 -0
- package/deploy/schemas/metaschema_modules_public/tables/user_auth_module/table.sql +1 -1
- package/deploy/schemas/metaschema_modules_public/tables/{secrets_module → user_state_module}/table.sql +4 -4
- package/metaschema-modules.control +1 -1
- package/package.json +4 -4
- package/pgpm.plan +15 -3
- package/revert/schemas/metaschema_modules_public/tables/agent_module/table.sql +7 -0
- package/revert/schemas/metaschema_modules_public/tables/compute_log_module/table.sql +3 -0
- package/revert/schemas/metaschema_modules_public/tables/config_secrets_org_module/table.sql +7 -0
- package/revert/schemas/metaschema_modules_public/tables/config_secrets_user_module/table.sql +7 -0
- package/revert/schemas/metaschema_modules_public/tables/db_usage_module/table.sql +3 -0
- package/revert/schemas/metaschema_modules_public/tables/events_module/table.sql +7 -0
- package/revert/schemas/metaschema_modules_public/tables/function_module/table.sql +7 -0
- package/revert/schemas/metaschema_modules_public/tables/graph_module/table.sql +7 -0
- package/revert/schemas/metaschema_modules_public/tables/inference_log_module/table.sql +3 -0
- package/revert/schemas/metaschema_modules_public/tables/merkle_store_module/table.sql +7 -0
- package/revert/schemas/metaschema_modules_public/tables/namespace_module/table.sql +7 -0
- package/revert/schemas/metaschema_modules_public/tables/rate_limit_meters_module/table.sql +7 -0
- package/revert/schemas/metaschema_modules_public/tables/storage_log_module/table.sql +3 -0
- package/revert/schemas/metaschema_modules_public/tables/transfer_log_module/table.sql +3 -0
- package/revert/schemas/metaschema_modules_public/tables/user_state_module/table.sql +7 -0
- package/sql/{metaschema-modules--0.15.5.sql → metaschema-modules--0.26.0.sql} +884 -213
- package/verify/schemas/metaschema_modules_public/tables/agent_module/table.sql +7 -0
- package/verify/schemas/metaschema_modules_public/tables/billing_module/table.sql +2 -0
- package/verify/schemas/metaschema_modules_public/tables/compute_log_module/table.sql +9 -0
- package/verify/schemas/metaschema_modules_public/tables/config_secrets_org_module/table.sql +7 -0
- package/verify/schemas/metaschema_modules_public/tables/config_secrets_user_module/table.sql +7 -0
- package/verify/schemas/metaschema_modules_public/tables/db_usage_module/table.sql +10 -0
- package/verify/schemas/metaschema_modules_public/tables/events_module/table.sql +7 -0
- package/verify/schemas/metaschema_modules_public/tables/function_module/table.sql +7 -0
- package/verify/schemas/metaschema_modules_public/tables/graph_module/table.sql +7 -0
- package/verify/schemas/metaschema_modules_public/tables/inference_log_module/table.sql +22 -0
- package/verify/schemas/metaschema_modules_public/tables/merkle_store_module/table.sql +7 -0
- package/verify/schemas/metaschema_modules_public/tables/namespace_module/table.sql +14 -0
- package/verify/schemas/metaschema_modules_public/tables/profiles_module/table.sql +2 -1
- package/verify/schemas/metaschema_modules_public/tables/rate_limit_meters_module/table.sql +7 -0
- package/verify/schemas/metaschema_modules_public/tables/storage_log_module/table.sql +10 -0
- package/verify/schemas/metaschema_modules_public/tables/transfer_log_module/table.sql +10 -0
- package/verify/schemas/metaschema_modules_public/tables/user_state_module/table.sql +7 -0
- package/deploy/schemas/metaschema_modules_public/tables/levels_module/table.sql +0 -64
- package/deploy/schemas/metaschema_modules_public/tables/table_template_module/table.sql +0 -43
- package/revert/schemas/metaschema_modules_public/tables/encrypted_secrets_module/table.sql +0 -7
- package/revert/schemas/metaschema_modules_public/tables/levels_module/table.sql +0 -7
- package/revert/schemas/metaschema_modules_public/tables/secrets_module/table.sql +0 -7
- package/revert/schemas/metaschema_modules_public/tables/table_template_module/table.sql +0 -7
- package/verify/schemas/metaschema_modules_public/tables/encrypted_secrets_module/table.sql +0 -7
- package/verify/schemas/metaschema_modules_public/tables/levels_module/table.sql +0 -7
- package/verify/schemas/metaschema_modules_public/tables/secrets_module/table.sql +0 -7
- package/verify/schemas/metaschema_modules_public/tables/table_template_module/table.sql +0 -18
|
@@ -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.
|
|
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.
|
|
44
|
+
REFERENCES metaschema_public.table (id)
|
|
45
45
|
ON DELETE CASCADE,
|
|
46
46
|
CONSTRAINT schema_fkey
|
|
47
47
|
FOREIGN KEY(schema_id)
|
|
@@ -70,11 +70,11 @@ CREATE TABLE metaschema_modules_public.crypto_addresses_module (
|
|
|
70
70
|
ON DELETE CASCADE,
|
|
71
71
|
CONSTRAINT table_fkey
|
|
72
72
|
FOREIGN KEY(table_id)
|
|
73
|
-
REFERENCES metaschema_public.
|
|
73
|
+
REFERENCES metaschema_public.table (id)
|
|
74
74
|
ON DELETE CASCADE,
|
|
75
75
|
CONSTRAINT owner_table_fkey
|
|
76
76
|
FOREIGN KEY(owner_table_id)
|
|
77
|
-
REFERENCES metaschema_public.
|
|
77
|
+
REFERENCES metaschema_public.table (id)
|
|
78
78
|
ON DELETE CASCADE,
|
|
79
79
|
CONSTRAINT schema_fkey
|
|
80
80
|
FOREIGN KEY(schema_id)
|
|
@@ -109,19 +109,19 @@ CREATE TABLE metaschema_modules_public.crypto_auth_module (
|
|
|
109
109
|
ON DELETE CASCADE,
|
|
110
110
|
CONSTRAINT secrets_table_fkey
|
|
111
111
|
FOREIGN KEY(secrets_table_id)
|
|
112
|
-
REFERENCES metaschema_public.
|
|
112
|
+
REFERENCES metaschema_public.table (id)
|
|
113
113
|
ON DELETE CASCADE,
|
|
114
114
|
CONSTRAINT users_table_fkey
|
|
115
115
|
FOREIGN KEY(users_table_id)
|
|
116
|
-
REFERENCES metaschema_public.
|
|
116
|
+
REFERENCES metaschema_public.table (id)
|
|
117
117
|
ON DELETE CASCADE,
|
|
118
118
|
CONSTRAINT sessions_table_fkey
|
|
119
119
|
FOREIGN KEY(sessions_table_id)
|
|
120
|
-
REFERENCES metaschema_public.
|
|
120
|
+
REFERENCES metaschema_public.table (id)
|
|
121
121
|
ON DELETE CASCADE,
|
|
122
122
|
CONSTRAINT session_credentials_table_fkey
|
|
123
123
|
FOREIGN KEY(session_credentials_table_id)
|
|
124
|
-
REFERENCES metaschema_public.
|
|
124
|
+
REFERENCES metaschema_public.table (id)
|
|
125
125
|
ON DELETE CASCADE,
|
|
126
126
|
CONSTRAINT schema_fkey
|
|
127
127
|
FOREIGN KEY(schema_id)
|
|
@@ -161,11 +161,11 @@ CREATE TABLE metaschema_modules_public.denormalized_table_field (
|
|
|
161
161
|
ON DELETE CASCADE,
|
|
162
162
|
CONSTRAINT table_fkey
|
|
163
163
|
FOREIGN KEY(table_id)
|
|
164
|
-
REFERENCES metaschema_public.
|
|
164
|
+
REFERENCES metaschema_public.table (id)
|
|
165
165
|
ON DELETE CASCADE,
|
|
166
166
|
CONSTRAINT ref_table_fkey
|
|
167
167
|
FOREIGN KEY(ref_table_id)
|
|
168
|
-
REFERENCES metaschema_public.
|
|
168
|
+
REFERENCES metaschema_public.table (id)
|
|
169
169
|
ON DELETE CASCADE,
|
|
170
170
|
CONSTRAINT field_fkey
|
|
171
171
|
FOREIGN KEY(field_id)
|
|
@@ -193,11 +193,11 @@ CREATE TABLE metaschema_modules_public.emails_module (
|
|
|
193
193
|
ON DELETE CASCADE,
|
|
194
194
|
CONSTRAINT table_fkey
|
|
195
195
|
FOREIGN KEY(table_id)
|
|
196
|
-
REFERENCES metaschema_public.
|
|
196
|
+
REFERENCES metaschema_public.table (id)
|
|
197
197
|
ON DELETE CASCADE,
|
|
198
198
|
CONSTRAINT owner_table_fkey
|
|
199
199
|
FOREIGN KEY(owner_table_id)
|
|
200
|
-
REFERENCES metaschema_public.
|
|
200
|
+
REFERENCES metaschema_public.table (id)
|
|
201
201
|
ON DELETE CASCADE,
|
|
202
202
|
CONSTRAINT schema_fkey
|
|
203
203
|
FOREIGN KEY(schema_id)
|
|
@@ -211,12 +211,12 @@ CREATE TABLE metaschema_modules_public.emails_module (
|
|
|
211
211
|
|
|
212
212
|
CREATE INDEX emails_module_database_id_idx ON metaschema_modules_public.emails_module (database_id);
|
|
213
213
|
|
|
214
|
-
CREATE TABLE metaschema_modules_public.
|
|
214
|
+
CREATE TABLE metaschema_modules_public.config_secrets_user_module (
|
|
215
215
|
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
216
216
|
database_id uuid NOT NULL,
|
|
217
217
|
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
218
218
|
table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
219
|
-
table_name text NOT NULL DEFAULT '
|
|
219
|
+
table_name text NOT NULL DEFAULT 'user_secrets',
|
|
220
220
|
CONSTRAINT db_fkey
|
|
221
221
|
FOREIGN KEY(database_id)
|
|
222
222
|
REFERENCES metaschema_public.database (id)
|
|
@@ -227,11 +227,11 @@ CREATE TABLE metaschema_modules_public.encrypted_secrets_module (
|
|
|
227
227
|
ON DELETE CASCADE,
|
|
228
228
|
CONSTRAINT table_fkey
|
|
229
229
|
FOREIGN KEY(table_id)
|
|
230
|
-
REFERENCES metaschema_public.
|
|
230
|
+
REFERENCES metaschema_public.table (id)
|
|
231
231
|
ON DELETE CASCADE
|
|
232
232
|
);
|
|
233
233
|
|
|
234
|
-
CREATE INDEX
|
|
234
|
+
CREATE INDEX config_secrets_user_module_database_id_idx ON metaschema_modules_public.config_secrets_user_module (database_id);
|
|
235
235
|
|
|
236
236
|
CREATE TABLE metaschema_modules_public.invites_module (
|
|
237
237
|
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
@@ -254,23 +254,23 @@ CREATE TABLE metaschema_modules_public.invites_module (
|
|
|
254
254
|
ON DELETE CASCADE,
|
|
255
255
|
CONSTRAINT invites_table_fkey
|
|
256
256
|
FOREIGN KEY(invites_table_id)
|
|
257
|
-
REFERENCES metaschema_public.
|
|
257
|
+
REFERENCES metaschema_public.table (id)
|
|
258
258
|
ON DELETE CASCADE,
|
|
259
259
|
CONSTRAINT emails_table_fkey
|
|
260
260
|
FOREIGN KEY(emails_table_id)
|
|
261
|
-
REFERENCES metaschema_public.
|
|
261
|
+
REFERENCES metaschema_public.table (id)
|
|
262
262
|
ON DELETE CASCADE,
|
|
263
263
|
CONSTRAINT users_table_fkey
|
|
264
264
|
FOREIGN KEY(users_table_id)
|
|
265
|
-
REFERENCES metaschema_public.
|
|
265
|
+
REFERENCES metaschema_public.table (id)
|
|
266
266
|
ON DELETE CASCADE,
|
|
267
267
|
CONSTRAINT entity_table_fkey
|
|
268
268
|
FOREIGN KEY(entity_table_id)
|
|
269
|
-
REFERENCES metaschema_public.
|
|
269
|
+
REFERENCES metaschema_public.table (id)
|
|
270
270
|
ON DELETE CASCADE,
|
|
271
271
|
CONSTRAINT claimed_invites_table_fkey
|
|
272
272
|
FOREIGN KEY(claimed_invites_table_id)
|
|
273
|
-
REFERENCES metaschema_public.
|
|
273
|
+
REFERENCES metaschema_public.table (id)
|
|
274
274
|
ON DELETE CASCADE,
|
|
275
275
|
CONSTRAINT schema_fkey
|
|
276
276
|
FOREIGN KEY(schema_id)
|
|
@@ -286,29 +286,42 @@ CREATE INDEX invites_module_database_id_idx ON metaschema_modules_public.invites
|
|
|
286
286
|
|
|
287
287
|
CREATE UNIQUE INDEX invites_module_unique_scope ON metaschema_modules_public.invites_module (database_id, membership_type);
|
|
288
288
|
|
|
289
|
-
CREATE TABLE metaschema_modules_public.
|
|
289
|
+
CREATE TABLE metaschema_modules_public.events_module (
|
|
290
290
|
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
291
291
|
database_id uuid NOT NULL,
|
|
292
292
|
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
293
293
|
private_schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
294
|
+
events_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
295
|
+
events_table_name text NOT NULL DEFAULT '',
|
|
296
|
+
event_aggregates_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
297
|
+
event_aggregates_table_name text NOT NULL DEFAULT '',
|
|
298
|
+
event_types_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
299
|
+
event_types_table_name text NOT NULL DEFAULT '',
|
|
298
300
|
levels_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
299
301
|
levels_table_name text NOT NULL DEFAULT '',
|
|
300
302
|
level_requirements_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
301
303
|
level_requirements_table_name text NOT NULL DEFAULT '',
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
304
|
+
level_grants_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
305
|
+
level_grants_table_name text NOT NULL DEFAULT '',
|
|
306
|
+
achievement_rewards_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
307
|
+
achievement_rewards_table_name text NOT NULL DEFAULT '',
|
|
308
|
+
record_event text NOT NULL DEFAULT '',
|
|
309
|
+
remove_event text NOT NULL DEFAULT '',
|
|
310
|
+
tg_event text NOT NULL DEFAULT '',
|
|
311
|
+
tg_event_toggle text NOT NULL DEFAULT '',
|
|
312
|
+
tg_event_toggle_bool text NOT NULL DEFAULT '',
|
|
313
|
+
tg_event_bool text NOT NULL DEFAULT '',
|
|
314
|
+
upsert_aggregate text NOT NULL DEFAULT '',
|
|
315
|
+
tg_update_aggregates text NOT NULL DEFAULT '',
|
|
316
|
+
prune_events text NOT NULL DEFAULT '',
|
|
310
317
|
steps_required text NOT NULL DEFAULT '',
|
|
311
318
|
level_achieved text NOT NULL DEFAULT '',
|
|
319
|
+
tg_check_achievements text NOT NULL DEFAULT '',
|
|
320
|
+
grant_achievement text NOT NULL DEFAULT '',
|
|
321
|
+
tg_achievement_reward text NOT NULL DEFAULT '',
|
|
322
|
+
"interval" text NOT NULL DEFAULT '1 month',
|
|
323
|
+
retention text DEFAULT '12 months',
|
|
324
|
+
premake int NOT NULL DEFAULT 2,
|
|
312
325
|
prefix text NULL,
|
|
313
326
|
membership_type int NOT NULL,
|
|
314
327
|
entity_table_id uuid NULL,
|
|
@@ -325,33 +338,45 @@ CREATE TABLE metaschema_modules_public.levels_module (
|
|
|
325
338
|
FOREIGN KEY(private_schema_id)
|
|
326
339
|
REFERENCES metaschema_public.schema (id)
|
|
327
340
|
ON DELETE CASCADE,
|
|
328
|
-
CONSTRAINT
|
|
329
|
-
FOREIGN KEY(
|
|
330
|
-
REFERENCES metaschema_public.
|
|
341
|
+
CONSTRAINT events_table_fkey
|
|
342
|
+
FOREIGN KEY(events_table_id)
|
|
343
|
+
REFERENCES metaschema_public.table (id)
|
|
344
|
+
ON DELETE CASCADE,
|
|
345
|
+
CONSTRAINT event_aggregates_table_fkey
|
|
346
|
+
FOREIGN KEY(event_aggregates_table_id)
|
|
347
|
+
REFERENCES metaschema_public.table (id)
|
|
331
348
|
ON DELETE CASCADE,
|
|
332
|
-
CONSTRAINT
|
|
333
|
-
FOREIGN KEY(
|
|
334
|
-
REFERENCES metaschema_public.
|
|
349
|
+
CONSTRAINT event_types_table_fkey
|
|
350
|
+
FOREIGN KEY(event_types_table_id)
|
|
351
|
+
REFERENCES metaschema_public.table (id)
|
|
335
352
|
ON DELETE CASCADE,
|
|
336
353
|
CONSTRAINT levels_table_fkey
|
|
337
354
|
FOREIGN KEY(levels_table_id)
|
|
338
|
-
REFERENCES metaschema_public.
|
|
355
|
+
REFERENCES metaschema_public.table (id)
|
|
339
356
|
ON DELETE CASCADE,
|
|
340
357
|
CONSTRAINT level_requirements_table_fkey
|
|
341
358
|
FOREIGN KEY(level_requirements_table_id)
|
|
342
|
-
REFERENCES metaschema_public.
|
|
359
|
+
REFERENCES metaschema_public.table (id)
|
|
360
|
+
ON DELETE CASCADE,
|
|
361
|
+
CONSTRAINT level_grants_table_fkey
|
|
362
|
+
FOREIGN KEY(level_grants_table_id)
|
|
363
|
+
REFERENCES metaschema_public.table (id)
|
|
364
|
+
ON DELETE CASCADE,
|
|
365
|
+
CONSTRAINT achievement_rewards_table_fkey
|
|
366
|
+
FOREIGN KEY(achievement_rewards_table_id)
|
|
367
|
+
REFERENCES metaschema_public.table (id)
|
|
343
368
|
ON DELETE CASCADE,
|
|
344
369
|
CONSTRAINT entity_table_fkey
|
|
345
370
|
FOREIGN KEY(entity_table_id)
|
|
346
|
-
REFERENCES metaschema_public.
|
|
371
|
+
REFERENCES metaschema_public.table (id)
|
|
347
372
|
ON DELETE CASCADE,
|
|
348
373
|
CONSTRAINT actor_table_fkey
|
|
349
374
|
FOREIGN KEY(actor_table_id)
|
|
350
|
-
REFERENCES metaschema_public.
|
|
375
|
+
REFERENCES metaschema_public.table (id)
|
|
351
376
|
ON DELETE CASCADE
|
|
352
377
|
);
|
|
353
378
|
|
|
354
|
-
CREATE INDEX
|
|
379
|
+
CREATE INDEX events_module_database_id_idx ON metaschema_modules_public.events_module (database_id);
|
|
355
380
|
|
|
356
381
|
CREATE TABLE metaschema_modules_public.limits_module (
|
|
357
382
|
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
@@ -378,6 +403,10 @@ CREATE TABLE metaschema_modules_public.limits_module (
|
|
|
378
403
|
limit_caps_defaults_table_id uuid NULL,
|
|
379
404
|
cap_check_trigger text NOT NULL DEFAULT '',
|
|
380
405
|
resolve_cap_function text NOT NULL DEFAULT '',
|
|
406
|
+
limit_warnings_table_id uuid NULL,
|
|
407
|
+
limit_warning_state_table_id uuid NULL,
|
|
408
|
+
limit_check_soft_function text NOT NULL DEFAULT '',
|
|
409
|
+
limit_aggregate_check_soft_function text NOT NULL DEFAULT '',
|
|
381
410
|
prefix text NULL,
|
|
382
411
|
membership_type int NOT NULL,
|
|
383
412
|
entity_table_id uuid NULL,
|
|
@@ -396,51 +425,59 @@ CREATE TABLE metaschema_modules_public.limits_module (
|
|
|
396
425
|
ON DELETE CASCADE,
|
|
397
426
|
CONSTRAINT table_fkey
|
|
398
427
|
FOREIGN KEY(table_id)
|
|
399
|
-
REFERENCES metaschema_public.
|
|
428
|
+
REFERENCES metaschema_public.table (id)
|
|
400
429
|
ON DELETE CASCADE,
|
|
401
430
|
CONSTRAINT default_table_fkey
|
|
402
431
|
FOREIGN KEY(default_table_id)
|
|
403
|
-
REFERENCES metaschema_public.
|
|
432
|
+
REFERENCES metaschema_public.table (id)
|
|
404
433
|
ON DELETE CASCADE,
|
|
405
434
|
CONSTRAINT entity_table_fkey
|
|
406
435
|
FOREIGN KEY(entity_table_id)
|
|
407
|
-
REFERENCES metaschema_public.
|
|
436
|
+
REFERENCES metaschema_public.table (id)
|
|
408
437
|
ON DELETE CASCADE,
|
|
409
438
|
CONSTRAINT actor_table_fkey
|
|
410
439
|
FOREIGN KEY(actor_table_id)
|
|
411
|
-
REFERENCES metaschema_public.
|
|
440
|
+
REFERENCES metaschema_public.table (id)
|
|
412
441
|
ON DELETE CASCADE,
|
|
413
442
|
CONSTRAINT aggregate_table_fkey
|
|
414
443
|
FOREIGN KEY(aggregate_table_id)
|
|
415
|
-
REFERENCES metaschema_public.
|
|
444
|
+
REFERENCES metaschema_public.table (id)
|
|
416
445
|
ON DELETE CASCADE,
|
|
417
446
|
CONSTRAINT limit_credits_table_fkey
|
|
418
447
|
FOREIGN KEY(limit_credits_table_id)
|
|
419
|
-
REFERENCES metaschema_public.
|
|
448
|
+
REFERENCES metaschema_public.table (id)
|
|
420
449
|
ON DELETE CASCADE,
|
|
421
450
|
CONSTRAINT events_table_fkey
|
|
422
451
|
FOREIGN KEY(events_table_id)
|
|
423
|
-
REFERENCES metaschema_public.
|
|
452
|
+
REFERENCES metaschema_public.table (id)
|
|
424
453
|
ON DELETE CASCADE,
|
|
425
454
|
CONSTRAINT credit_codes_table_fkey
|
|
426
455
|
FOREIGN KEY(credit_codes_table_id)
|
|
427
|
-
REFERENCES metaschema_public.
|
|
456
|
+
REFERENCES metaschema_public.table (id)
|
|
428
457
|
ON DELETE CASCADE,
|
|
429
458
|
CONSTRAINT credit_code_items_table_fkey
|
|
430
459
|
FOREIGN KEY(credit_code_items_table_id)
|
|
431
|
-
REFERENCES metaschema_public.
|
|
460
|
+
REFERENCES metaschema_public.table (id)
|
|
432
461
|
ON DELETE CASCADE,
|
|
433
462
|
CONSTRAINT credit_redemptions_table_fkey
|
|
434
463
|
FOREIGN KEY(credit_redemptions_table_id)
|
|
435
|
-
REFERENCES metaschema_public.
|
|
464
|
+
REFERENCES metaschema_public.table (id)
|
|
436
465
|
ON DELETE CASCADE,
|
|
437
466
|
CONSTRAINT limit_caps_table_fkey
|
|
438
467
|
FOREIGN KEY(limit_caps_table_id)
|
|
439
|
-
REFERENCES metaschema_public.
|
|
468
|
+
REFERENCES metaschema_public.table (id)
|
|
440
469
|
ON DELETE CASCADE,
|
|
441
470
|
CONSTRAINT limit_caps_defaults_table_fkey
|
|
442
471
|
FOREIGN KEY(limit_caps_defaults_table_id)
|
|
443
|
-
REFERENCES metaschema_public.
|
|
472
|
+
REFERENCES metaschema_public.table (id)
|
|
473
|
+
ON DELETE CASCADE,
|
|
474
|
+
CONSTRAINT limit_warnings_table_fkey
|
|
475
|
+
FOREIGN KEY(limit_warnings_table_id)
|
|
476
|
+
REFERENCES metaschema_public.table (id)
|
|
477
|
+
ON DELETE CASCADE,
|
|
478
|
+
CONSTRAINT limit_warning_state_table_fkey
|
|
479
|
+
FOREIGN KEY(limit_warning_state_table_id)
|
|
480
|
+
REFERENCES metaschema_public.table (id)
|
|
444
481
|
ON DELETE CASCADE
|
|
445
482
|
);
|
|
446
483
|
|
|
@@ -462,7 +499,7 @@ CREATE TABLE metaschema_modules_public.membership_types_module (
|
|
|
462
499
|
ON DELETE CASCADE,
|
|
463
500
|
CONSTRAINT table_fkey
|
|
464
501
|
FOREIGN KEY(table_id)
|
|
465
|
-
REFERENCES metaschema_public.
|
|
502
|
+
REFERENCES metaschema_public.table (id)
|
|
466
503
|
ON DELETE CASCADE
|
|
467
504
|
);
|
|
468
505
|
|
|
@@ -517,31 +554,31 @@ CREATE TABLE metaschema_modules_public.memberships_module (
|
|
|
517
554
|
ON DELETE CASCADE,
|
|
518
555
|
CONSTRAINT memberships_table_fkey
|
|
519
556
|
FOREIGN KEY(memberships_table_id)
|
|
520
|
-
REFERENCES metaschema_public.
|
|
557
|
+
REFERENCES metaschema_public.table (id)
|
|
521
558
|
ON DELETE CASCADE,
|
|
522
559
|
CONSTRAINT membership_defaults_table_fkey
|
|
523
560
|
FOREIGN KEY(membership_defaults_table_id)
|
|
524
|
-
REFERENCES metaschema_public.
|
|
561
|
+
REFERENCES metaschema_public.table (id)
|
|
525
562
|
ON DELETE CASCADE,
|
|
526
563
|
CONSTRAINT membership_settings_table_fkey
|
|
527
564
|
FOREIGN KEY(membership_settings_table_id)
|
|
528
|
-
REFERENCES metaschema_public.
|
|
565
|
+
REFERENCES metaschema_public.table (id)
|
|
529
566
|
ON DELETE CASCADE,
|
|
530
567
|
CONSTRAINT members_table_fkey
|
|
531
568
|
FOREIGN KEY(members_table_id)
|
|
532
|
-
REFERENCES metaschema_public.
|
|
569
|
+
REFERENCES metaschema_public.table (id)
|
|
533
570
|
ON DELETE CASCADE,
|
|
534
571
|
CONSTRAINT grants_table_fkey
|
|
535
572
|
FOREIGN KEY(grants_table_id)
|
|
536
|
-
REFERENCES metaschema_public.
|
|
573
|
+
REFERENCES metaschema_public.table (id)
|
|
537
574
|
ON DELETE CASCADE,
|
|
538
575
|
CONSTRAINT sprt_table_fkey
|
|
539
576
|
FOREIGN KEY(sprt_table_id)
|
|
540
|
-
REFERENCES metaschema_public.
|
|
577
|
+
REFERENCES metaschema_public.table (id)
|
|
541
578
|
ON DELETE CASCADE,
|
|
542
579
|
CONSTRAINT entity_table_fkey
|
|
543
580
|
FOREIGN KEY(entity_table_id)
|
|
544
|
-
REFERENCES metaschema_public.
|
|
581
|
+
REFERENCES metaschema_public.table (id)
|
|
545
582
|
ON DELETE CASCADE,
|
|
546
583
|
CONSTRAINT entity_table_owner_fkey
|
|
547
584
|
FOREIGN KEY(entity_table_owner_id)
|
|
@@ -549,23 +586,23 @@ CREATE TABLE metaschema_modules_public.memberships_module (
|
|
|
549
586
|
ON DELETE CASCADE,
|
|
550
587
|
CONSTRAINT actor_table_fkey
|
|
551
588
|
FOREIGN KEY(actor_table_id)
|
|
552
|
-
REFERENCES metaschema_public.
|
|
589
|
+
REFERENCES metaschema_public.table (id)
|
|
553
590
|
ON DELETE CASCADE,
|
|
554
591
|
CONSTRAINT limits_table_fkey
|
|
555
592
|
FOREIGN KEY(limits_table_id)
|
|
556
|
-
REFERENCES metaschema_public.
|
|
593
|
+
REFERENCES metaschema_public.table (id)
|
|
557
594
|
ON DELETE CASCADE,
|
|
558
595
|
CONSTRAINT default_limits_table_fkey
|
|
559
596
|
FOREIGN KEY(default_limits_table_id)
|
|
560
|
-
REFERENCES metaschema_public.
|
|
597
|
+
REFERENCES metaschema_public.table (id)
|
|
561
598
|
ON DELETE CASCADE,
|
|
562
599
|
CONSTRAINT permissions_table_fkey
|
|
563
600
|
FOREIGN KEY(permissions_table_id)
|
|
564
|
-
REFERENCES metaschema_public.
|
|
601
|
+
REFERENCES metaschema_public.table (id)
|
|
565
602
|
ON DELETE CASCADE,
|
|
566
603
|
CONSTRAINT default_permissions_table_fkey
|
|
567
604
|
FOREIGN KEY(default_permissions_table_id)
|
|
568
|
-
REFERENCES metaschema_public.
|
|
605
|
+
REFERENCES metaschema_public.table (id)
|
|
569
606
|
ON DELETE CASCADE
|
|
570
607
|
);
|
|
571
608
|
|
|
@@ -603,19 +640,19 @@ CREATE TABLE metaschema_modules_public.permissions_module (
|
|
|
603
640
|
ON DELETE CASCADE,
|
|
604
641
|
CONSTRAINT table_fkey
|
|
605
642
|
FOREIGN KEY(table_id)
|
|
606
|
-
REFERENCES metaschema_public.
|
|
643
|
+
REFERENCES metaschema_public.table (id)
|
|
607
644
|
ON DELETE CASCADE,
|
|
608
645
|
CONSTRAINT default_table_fkey
|
|
609
646
|
FOREIGN KEY(default_table_id)
|
|
610
|
-
REFERENCES metaschema_public.
|
|
647
|
+
REFERENCES metaschema_public.table (id)
|
|
611
648
|
ON DELETE CASCADE,
|
|
612
649
|
CONSTRAINT entity_table_fkey
|
|
613
650
|
FOREIGN KEY(entity_table_id)
|
|
614
|
-
REFERENCES metaschema_public.
|
|
651
|
+
REFERENCES metaschema_public.table (id)
|
|
615
652
|
ON DELETE CASCADE,
|
|
616
653
|
CONSTRAINT actor_table_fkey
|
|
617
654
|
FOREIGN KEY(actor_table_id)
|
|
618
|
-
REFERENCES metaschema_public.
|
|
655
|
+
REFERENCES metaschema_public.table (id)
|
|
619
656
|
ON DELETE CASCADE
|
|
620
657
|
);
|
|
621
658
|
|
|
@@ -635,11 +672,11 @@ CREATE TABLE metaschema_modules_public.phone_numbers_module (
|
|
|
635
672
|
ON DELETE CASCADE,
|
|
636
673
|
CONSTRAINT table_fkey
|
|
637
674
|
FOREIGN KEY(table_id)
|
|
638
|
-
REFERENCES metaschema_public.
|
|
675
|
+
REFERENCES metaschema_public.table (id)
|
|
639
676
|
ON DELETE CASCADE,
|
|
640
677
|
CONSTRAINT owner_table_fkey
|
|
641
678
|
FOREIGN KEY(owner_table_id)
|
|
642
|
-
REFERENCES metaschema_public.
|
|
679
|
+
REFERENCES metaschema_public.table (id)
|
|
643
680
|
ON DELETE CASCADE,
|
|
644
681
|
CONSTRAINT schema_fkey
|
|
645
682
|
FOREIGN KEY(schema_id)
|
|
@@ -688,39 +725,39 @@ CREATE TABLE metaschema_modules_public.profiles_module (
|
|
|
688
725
|
ON DELETE CASCADE,
|
|
689
726
|
CONSTRAINT table_fkey
|
|
690
727
|
FOREIGN KEY(table_id)
|
|
691
|
-
REFERENCES metaschema_public.
|
|
728
|
+
REFERENCES metaschema_public.table (id)
|
|
692
729
|
ON DELETE CASCADE,
|
|
693
730
|
CONSTRAINT profile_permissions_table_fkey
|
|
694
731
|
FOREIGN KEY(profile_permissions_table_id)
|
|
695
|
-
REFERENCES metaschema_public.
|
|
732
|
+
REFERENCES metaschema_public.table (id)
|
|
696
733
|
ON DELETE CASCADE,
|
|
697
734
|
CONSTRAINT profile_grants_table_fkey
|
|
698
735
|
FOREIGN KEY(profile_grants_table_id)
|
|
699
|
-
REFERENCES metaschema_public.
|
|
736
|
+
REFERENCES metaschema_public.table (id)
|
|
700
737
|
ON DELETE CASCADE,
|
|
701
738
|
CONSTRAINT profile_definition_grants_table_fkey
|
|
702
739
|
FOREIGN KEY(profile_definition_grants_table_id)
|
|
703
|
-
REFERENCES metaschema_public.
|
|
740
|
+
REFERENCES metaschema_public.table (id)
|
|
704
741
|
ON DELETE CASCADE,
|
|
705
742
|
CONSTRAINT profile_templates_table_fkey
|
|
706
743
|
FOREIGN KEY(profile_templates_table_id)
|
|
707
|
-
REFERENCES metaschema_public.
|
|
744
|
+
REFERENCES metaschema_public.table (id)
|
|
708
745
|
ON DELETE CASCADE,
|
|
709
746
|
CONSTRAINT entity_table_fkey
|
|
710
747
|
FOREIGN KEY(entity_table_id)
|
|
711
|
-
REFERENCES metaschema_public.
|
|
748
|
+
REFERENCES metaschema_public.table (id)
|
|
712
749
|
ON DELETE CASCADE,
|
|
713
750
|
CONSTRAINT actor_table_fkey
|
|
714
751
|
FOREIGN KEY(actor_table_id)
|
|
715
|
-
REFERENCES metaschema_public.
|
|
752
|
+
REFERENCES metaschema_public.table (id)
|
|
716
753
|
ON DELETE CASCADE,
|
|
717
754
|
CONSTRAINT permissions_table_fkey
|
|
718
755
|
FOREIGN KEY(permissions_table_id)
|
|
719
|
-
REFERENCES metaschema_public.
|
|
756
|
+
REFERENCES metaschema_public.table (id)
|
|
720
757
|
ON DELETE CASCADE,
|
|
721
758
|
CONSTRAINT memberships_table_fkey
|
|
722
759
|
FOREIGN KEY(memberships_table_id)
|
|
723
|
-
REFERENCES metaschema_public.
|
|
760
|
+
REFERENCES metaschema_public.table (id)
|
|
724
761
|
ON DELETE CASCADE,
|
|
725
762
|
CONSTRAINT profiles_module_unique
|
|
726
763
|
UNIQUE (database_id, membership_type)
|
|
@@ -746,15 +783,15 @@ CREATE TABLE metaschema_modules_public.rls_module (
|
|
|
746
783
|
ON DELETE CASCADE,
|
|
747
784
|
CONSTRAINT session_credentials_table_fkey
|
|
748
785
|
FOREIGN KEY(session_credentials_table_id)
|
|
749
|
-
REFERENCES metaschema_public.
|
|
786
|
+
REFERENCES metaschema_public.table (id)
|
|
750
787
|
ON DELETE CASCADE,
|
|
751
788
|
CONSTRAINT sessions_table_fkey
|
|
752
789
|
FOREIGN KEY(sessions_table_id)
|
|
753
|
-
REFERENCES metaschema_public.
|
|
790
|
+
REFERENCES metaschema_public.table (id)
|
|
754
791
|
ON DELETE CASCADE,
|
|
755
792
|
CONSTRAINT users_table_fkey
|
|
756
793
|
FOREIGN KEY(users_table_id)
|
|
757
|
-
REFERENCES metaschema_public.
|
|
794
|
+
REFERENCES metaschema_public.table (id)
|
|
758
795
|
ON DELETE CASCADE,
|
|
759
796
|
CONSTRAINT schema_fkey
|
|
760
797
|
FOREIGN KEY(schema_id)
|
|
@@ -778,12 +815,12 @@ COMMENT ON CONSTRAINT users_table_fkey ON metaschema_modules_public.rls_module I
|
|
|
778
815
|
|
|
779
816
|
CREATE INDEX rls_module_database_id_idx ON metaschema_modules_public.rls_module (database_id);
|
|
780
817
|
|
|
781
|
-
CREATE TABLE metaschema_modules_public.
|
|
818
|
+
CREATE TABLE metaschema_modules_public.user_state_module (
|
|
782
819
|
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
783
820
|
database_id uuid NOT NULL,
|
|
784
821
|
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
785
822
|
table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
786
|
-
table_name text NOT NULL DEFAULT '
|
|
823
|
+
table_name text NOT NULL DEFAULT 'user_state',
|
|
787
824
|
CONSTRAINT db_fkey
|
|
788
825
|
FOREIGN KEY(database_id)
|
|
789
826
|
REFERENCES metaschema_public.database (id)
|
|
@@ -794,11 +831,11 @@ CREATE TABLE metaschema_modules_public.secrets_module (
|
|
|
794
831
|
ON DELETE CASCADE,
|
|
795
832
|
CONSTRAINT table_fkey
|
|
796
833
|
FOREIGN KEY(table_id)
|
|
797
|
-
REFERENCES metaschema_public.
|
|
834
|
+
REFERENCES metaschema_public.table (id)
|
|
798
835
|
ON DELETE CASCADE
|
|
799
836
|
);
|
|
800
837
|
|
|
801
|
-
CREATE INDEX
|
|
838
|
+
CREATE INDEX user_state_module_database_id_idx ON metaschema_modules_public.user_state_module (database_id);
|
|
802
839
|
|
|
803
840
|
CREATE TABLE metaschema_modules_public.sessions_module (
|
|
804
841
|
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
@@ -822,19 +859,19 @@ CREATE TABLE metaschema_modules_public.sessions_module (
|
|
|
822
859
|
ON DELETE CASCADE,
|
|
823
860
|
CONSTRAINT sessions_table_fkey
|
|
824
861
|
FOREIGN KEY(sessions_table_id)
|
|
825
|
-
REFERENCES metaschema_public.
|
|
862
|
+
REFERENCES metaschema_public.table (id)
|
|
826
863
|
ON DELETE CASCADE,
|
|
827
864
|
CONSTRAINT session_credentials_table_fkey
|
|
828
865
|
FOREIGN KEY(session_credentials_table_id)
|
|
829
|
-
REFERENCES metaschema_public.
|
|
866
|
+
REFERENCES metaschema_public.table (id)
|
|
830
867
|
ON DELETE CASCADE,
|
|
831
868
|
CONSTRAINT auth_settings_table_fkey
|
|
832
869
|
FOREIGN KEY(auth_settings_table_id)
|
|
833
|
-
REFERENCES metaschema_public.
|
|
870
|
+
REFERENCES metaschema_public.table (id)
|
|
834
871
|
ON DELETE CASCADE,
|
|
835
872
|
CONSTRAINT users_table_fkey
|
|
836
873
|
FOREIGN KEY(users_table_id)
|
|
837
|
-
REFERENCES metaschema_public.
|
|
874
|
+
REFERENCES metaschema_public.table (id)
|
|
838
875
|
ON DELETE CASCADE
|
|
839
876
|
);
|
|
840
877
|
|
|
@@ -857,7 +894,7 @@ CREATE TABLE metaschema_modules_public.user_auth_module (
|
|
|
857
894
|
sessions_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
858
895
|
session_credentials_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
859
896
|
audits_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
860
|
-
audits_table_name text NOT NULL DEFAULT '
|
|
897
|
+
audits_table_name text NOT NULL DEFAULT 'audit_log_auth',
|
|
861
898
|
sign_in_function text NOT NULL DEFAULT 'sign_in',
|
|
862
899
|
sign_up_function text NOT NULL DEFAULT 'sign_up',
|
|
863
900
|
sign_out_function text NOT NULL DEFAULT 'sign_out',
|
|
@@ -883,27 +920,27 @@ CREATE TABLE metaschema_modules_public.user_auth_module (
|
|
|
883
920
|
ON DELETE CASCADE,
|
|
884
921
|
CONSTRAINT email_table_fkey
|
|
885
922
|
FOREIGN KEY(emails_table_id)
|
|
886
|
-
REFERENCES metaschema_public.
|
|
923
|
+
REFERENCES metaschema_public.table (id)
|
|
887
924
|
ON DELETE CASCADE,
|
|
888
925
|
CONSTRAINT users_table_fkey
|
|
889
926
|
FOREIGN KEY(users_table_id)
|
|
890
|
-
REFERENCES metaschema_public.
|
|
927
|
+
REFERENCES metaschema_public.table (id)
|
|
891
928
|
ON DELETE CASCADE,
|
|
892
929
|
CONSTRAINT secrets_table_fkey
|
|
893
930
|
FOREIGN KEY(secrets_table_id)
|
|
894
|
-
REFERENCES metaschema_public.
|
|
931
|
+
REFERENCES metaschema_public.table (id)
|
|
895
932
|
ON DELETE CASCADE,
|
|
896
933
|
CONSTRAINT encrypted_table_fkey
|
|
897
934
|
FOREIGN KEY(encrypted_table_id)
|
|
898
|
-
REFERENCES metaschema_public.
|
|
935
|
+
REFERENCES metaschema_public.table (id)
|
|
899
936
|
ON DELETE CASCADE,
|
|
900
937
|
CONSTRAINT sessions_table_fkey
|
|
901
938
|
FOREIGN KEY(sessions_table_id)
|
|
902
|
-
REFERENCES metaschema_public.
|
|
939
|
+
REFERENCES metaschema_public.table (id)
|
|
903
940
|
ON DELETE CASCADE,
|
|
904
941
|
CONSTRAINT session_credentials_table_fkey
|
|
905
942
|
FOREIGN KEY(session_credentials_table_id)
|
|
906
|
-
REFERENCES metaschema_public.
|
|
943
|
+
REFERENCES metaschema_public.table (id)
|
|
907
944
|
ON DELETE CASCADE
|
|
908
945
|
);
|
|
909
946
|
|
|
@@ -939,11 +976,11 @@ CREATE TABLE metaschema_modules_public.users_module (
|
|
|
939
976
|
ON DELETE CASCADE,
|
|
940
977
|
CONSTRAINT table_fkey
|
|
941
978
|
FOREIGN KEY(table_id)
|
|
942
|
-
REFERENCES metaschema_public.
|
|
979
|
+
REFERENCES metaschema_public.table (id)
|
|
943
980
|
ON DELETE CASCADE,
|
|
944
981
|
CONSTRAINT type_table_fkey
|
|
945
982
|
FOREIGN KEY(type_table_id)
|
|
946
|
-
REFERENCES metaschema_public.
|
|
983
|
+
REFERENCES metaschema_public.table (id)
|
|
947
984
|
ON DELETE CASCADE
|
|
948
985
|
);
|
|
949
986
|
|
|
@@ -984,23 +1021,23 @@ CREATE TABLE metaschema_modules_public.hierarchy_module (
|
|
|
984
1021
|
ON DELETE CASCADE,
|
|
985
1022
|
CONSTRAINT chart_edges_table_fkey
|
|
986
1023
|
FOREIGN KEY(chart_edges_table_id)
|
|
987
|
-
REFERENCES metaschema_public.
|
|
1024
|
+
REFERENCES metaschema_public.table (id)
|
|
988
1025
|
ON DELETE CASCADE,
|
|
989
1026
|
CONSTRAINT hierarchy_sprt_table_fkey
|
|
990
1027
|
FOREIGN KEY(hierarchy_sprt_table_id)
|
|
991
|
-
REFERENCES metaschema_public.
|
|
1028
|
+
REFERENCES metaschema_public.table (id)
|
|
992
1029
|
ON DELETE CASCADE,
|
|
993
1030
|
CONSTRAINT chart_edge_grants_table_fkey
|
|
994
1031
|
FOREIGN KEY(chart_edge_grants_table_id)
|
|
995
|
-
REFERENCES metaschema_public.
|
|
1032
|
+
REFERENCES metaschema_public.table (id)
|
|
996
1033
|
ON DELETE CASCADE,
|
|
997
1034
|
CONSTRAINT entity_table_fkey
|
|
998
1035
|
FOREIGN KEY(entity_table_id)
|
|
999
|
-
REFERENCES metaschema_public.
|
|
1036
|
+
REFERENCES metaschema_public.table (id)
|
|
1000
1037
|
ON DELETE CASCADE,
|
|
1001
1038
|
CONSTRAINT users_table_fkey
|
|
1002
1039
|
FOREIGN KEY(users_table_id)
|
|
1003
|
-
REFERENCES metaschema_public.
|
|
1040
|
+
REFERENCES metaschema_public.table (id)
|
|
1004
1041
|
ON DELETE CASCADE,
|
|
1005
1042
|
CONSTRAINT hierarchy_module_database_unique
|
|
1006
1043
|
UNIQUE (database_id)
|
|
@@ -1026,7 +1063,7 @@ CREATE TABLE metaschema_modules_public.secure_table_provision (
|
|
|
1026
1063
|
ON DELETE CASCADE,
|
|
1027
1064
|
CONSTRAINT table_fkey
|
|
1028
1065
|
FOREIGN KEY(table_id)
|
|
1029
|
-
REFERENCES metaschema_public.
|
|
1066
|
+
REFERENCES metaschema_public.table (id)
|
|
1030
1067
|
ON DELETE CASCADE,
|
|
1031
1068
|
CONSTRAINT schema_fkey
|
|
1032
1069
|
FOREIGN KEY(schema_id)
|
|
@@ -1093,11 +1130,11 @@ CREATE TABLE metaschema_modules_public.relation_provision (
|
|
|
1093
1130
|
ON DELETE CASCADE,
|
|
1094
1131
|
CONSTRAINT source_table_fkey
|
|
1095
1132
|
FOREIGN KEY(source_table_id)
|
|
1096
|
-
REFERENCES metaschema_public.
|
|
1133
|
+
REFERENCES metaschema_public.table (id)
|
|
1097
1134
|
ON DELETE CASCADE,
|
|
1098
1135
|
CONSTRAINT target_table_fkey
|
|
1099
1136
|
FOREIGN KEY(target_table_id)
|
|
1100
|
-
REFERENCES metaschema_public.
|
|
1137
|
+
REFERENCES metaschema_public.table (id)
|
|
1101
1138
|
ON DELETE CASCADE
|
|
1102
1139
|
);
|
|
1103
1140
|
|
|
@@ -1420,8 +1457,9 @@ CREATE TABLE metaschema_modules_public.storage_module (
|
|
|
1420
1457
|
buckets_table_name text NOT NULL DEFAULT 'app_buckets',
|
|
1421
1458
|
files_table_name text NOT NULL DEFAULT 'app_files',
|
|
1422
1459
|
membership_type int DEFAULT NULL,
|
|
1460
|
+
storage_key text NOT NULL DEFAULT 'default',
|
|
1423
1461
|
policies jsonb NULL,
|
|
1424
|
-
|
|
1462
|
+
provisions jsonb NULL,
|
|
1425
1463
|
entity_table_id uuid NULL,
|
|
1426
1464
|
endpoint text NULL,
|
|
1427
1465
|
public_url_prefix text NULL,
|
|
@@ -1441,6 +1479,8 @@ CREATE TABLE metaschema_modules_public.storage_module (
|
|
|
1441
1479
|
has_content_hash boolean NOT NULL DEFAULT false,
|
|
1442
1480
|
has_custom_keys boolean NOT NULL DEFAULT false,
|
|
1443
1481
|
has_audit_log boolean NOT NULL DEFAULT false,
|
|
1482
|
+
has_confirm_upload boolean NOT NULL DEFAULT false,
|
|
1483
|
+
confirm_upload_delay interval NOT NULL DEFAULT '30 seconds',
|
|
1444
1484
|
file_events_table_id uuid NULL DEFAULT NULL,
|
|
1445
1485
|
CONSTRAINT db_fkey
|
|
1446
1486
|
FOREIGN KEY(database_id)
|
|
@@ -1456,29 +1496,29 @@ CREATE TABLE metaschema_modules_public.storage_module (
|
|
|
1456
1496
|
ON DELETE CASCADE,
|
|
1457
1497
|
CONSTRAINT buckets_table_fkey
|
|
1458
1498
|
FOREIGN KEY(buckets_table_id)
|
|
1459
|
-
REFERENCES metaschema_public.
|
|
1499
|
+
REFERENCES metaschema_public.table (id)
|
|
1460
1500
|
ON DELETE CASCADE,
|
|
1461
1501
|
CONSTRAINT files_table_fkey
|
|
1462
1502
|
FOREIGN KEY(files_table_id)
|
|
1463
|
-
REFERENCES metaschema_public.
|
|
1503
|
+
REFERENCES metaschema_public.table (id)
|
|
1464
1504
|
ON DELETE CASCADE,
|
|
1465
1505
|
CONSTRAINT entity_table_fkey
|
|
1466
1506
|
FOREIGN KEY(entity_table_id)
|
|
1467
|
-
REFERENCES metaschema_public.
|
|
1507
|
+
REFERENCES metaschema_public.table (id)
|
|
1468
1508
|
ON DELETE CASCADE,
|
|
1469
1509
|
CONSTRAINT path_shares_table_fkey
|
|
1470
1510
|
FOREIGN KEY(path_shares_table_id)
|
|
1471
|
-
REFERENCES metaschema_public.
|
|
1511
|
+
REFERENCES metaschema_public.table (id)
|
|
1472
1512
|
ON DELETE CASCADE,
|
|
1473
1513
|
CONSTRAINT file_events_table_fkey
|
|
1474
1514
|
FOREIGN KEY(file_events_table_id)
|
|
1475
|
-
REFERENCES metaschema_public.
|
|
1515
|
+
REFERENCES metaschema_public.table (id)
|
|
1476
1516
|
ON DELETE CASCADE
|
|
1477
1517
|
);
|
|
1478
1518
|
|
|
1479
1519
|
CREATE INDEX storage_module_database_id_idx ON metaschema_modules_public.storage_module (database_id);
|
|
1480
1520
|
|
|
1481
|
-
CREATE UNIQUE INDEX storage_module_unique_scope ON metaschema_modules_public.storage_module (database_id, (COALESCE(membership_type, -1)));
|
|
1521
|
+
CREATE UNIQUE INDEX storage_module_unique_scope ON metaschema_modules_public.storage_module (database_id, (COALESCE(membership_type, -1)), storage_key);
|
|
1482
1522
|
|
|
1483
1523
|
CREATE TABLE metaschema_modules_public.entity_type_provision (
|
|
1484
1524
|
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
@@ -1492,9 +1532,13 @@ CREATE TABLE metaschema_modules_public.entity_type_provision (
|
|
|
1492
1532
|
has_limits boolean NOT NULL DEFAULT false,
|
|
1493
1533
|
has_profiles boolean NOT NULL DEFAULT false,
|
|
1494
1534
|
has_levels boolean NOT NULL DEFAULT false,
|
|
1495
|
-
has_storage boolean NOT NULL DEFAULT false,
|
|
1496
1535
|
has_invites boolean NOT NULL DEFAULT false,
|
|
1497
|
-
|
|
1536
|
+
has_invite_achievements boolean NOT NULL DEFAULT false,
|
|
1537
|
+
storage jsonb DEFAULT NULL,
|
|
1538
|
+
namespaces jsonb DEFAULT NULL,
|
|
1539
|
+
functions jsonb DEFAULT NULL,
|
|
1540
|
+
graphs jsonb DEFAULT NULL,
|
|
1541
|
+
agents jsonb DEFAULT NULL,
|
|
1498
1542
|
skip_entity_policies boolean NOT NULL DEFAULT false,
|
|
1499
1543
|
table_provision jsonb DEFAULT NULL,
|
|
1500
1544
|
out_membership_type int DEFAULT NULL,
|
|
@@ -1506,6 +1550,16 @@ CREATE TABLE metaschema_modules_public.entity_type_provision (
|
|
|
1506
1550
|
out_files_table_id uuid DEFAULT NULL,
|
|
1507
1551
|
out_path_shares_table_id uuid DEFAULT NULL,
|
|
1508
1552
|
out_invites_module_id uuid DEFAULT NULL,
|
|
1553
|
+
out_namespace_module_id uuid DEFAULT NULL,
|
|
1554
|
+
out_namespaces_table_id uuid DEFAULT NULL,
|
|
1555
|
+
out_namespace_events_table_id uuid DEFAULT NULL,
|
|
1556
|
+
out_function_module_id uuid DEFAULT NULL,
|
|
1557
|
+
out_definitions_table_id uuid DEFAULT NULL,
|
|
1558
|
+
out_invocations_table_id uuid DEFAULT NULL,
|
|
1559
|
+
out_execution_logs_table_id uuid DEFAULT NULL,
|
|
1560
|
+
out_graph_module_id uuid DEFAULT NULL,
|
|
1561
|
+
out_graphs_table_id uuid DEFAULT NULL,
|
|
1562
|
+
out_agent_module_id uuid DEFAULT NULL,
|
|
1509
1563
|
CONSTRAINT entity_type_provision_unique_prefix
|
|
1510
1564
|
UNIQUE (database_id, prefix),
|
|
1511
1565
|
CONSTRAINT entity_type_provision_db_fkey
|
|
@@ -1563,22 +1617,25 @@ COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.has_profiles I
|
|
|
1563
1617
|
Profiles provide named permission roles (e.g. ''Editor'', ''Viewer'') with pre-configured permission bitmasks.
|
|
1564
1618
|
When true, creates profile tables and applies profiles security.';
|
|
1565
1619
|
|
|
1566
|
-
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.has_levels IS 'Whether to provision
|
|
1620
|
+
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.has_levels IS 'Whether to provision events_module for this type. Defaults to false.
|
|
1567
1621
|
Levels provide gamification/achievement tracking for members.
|
|
1568
1622
|
When true, creates level steps, achievements, and level tables with security.';
|
|
1569
1623
|
|
|
1570
|
-
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.has_storage IS 'Whether to provision storage_module for this type. Defaults to false.
|
|
1571
|
-
When true, creates {prefix}_buckets and {prefix}_files tables
|
|
1572
|
-
with entity-scoped RLS (AuthzEntityMembership) using the entity''s membership_type.
|
|
1573
|
-
Storage tables get owner_id FK to the entity table, so files are owned by the entity.';
|
|
1574
|
-
|
|
1575
1624
|
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.has_invites IS 'Whether to provision invites_module for this type. Defaults to false.
|
|
1576
1625
|
When true, the trigger inserts a row into invites_module which in turn
|
|
1577
1626
|
(via insert_invites_module BEFORE INSERT) creates {prefix}_invites and
|
|
1578
1627
|
{prefix}_claimed_invites tables plus the submit_{prefix}_invite_code() function.
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1628
|
+
Re-provisioning is idempotent: the UNIQUE (database_id, membership_type) constraint
|
|
1629
|
+
on invites_module combined with ON CONFLICT DO NOTHING in the fan-out makes
|
|
1630
|
+
repeated INSERTs safe.';
|
|
1631
|
+
|
|
1632
|
+
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.has_invite_achievements IS 'Whether to auto-attach an EventTracker to the claimed_invites table for invite-based
|
|
1633
|
+
achievements. Defaults to false. Requires has_invites=true AND has_levels=true.
|
|
1634
|
+
When true, the trigger calls event_tracker() on the claimed_invites table with
|
|
1635
|
+
event_name=''invite_claimed'', actor_field=''sender_id'', events=[''INSERT''],
|
|
1636
|
+
crediting the SENDER (inviter) when someone claims their invite code.
|
|
1637
|
+
Developers can then define achievements in the blueprint achievements[] section
|
|
1638
|
+
that reference the ''invite_claimed'' event (e.g., "Invite 5 friends" = count: 5).';
|
|
1582
1639
|
|
|
1583
1640
|
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.skip_entity_policies IS 'Escape hatch: when true, apply zero RLS policies to the entity table. Defaults to false.
|
|
1584
1641
|
Use this only when you want the entity table provisioned with zero policies (e.g. because you
|
|
@@ -1633,47 +1690,86 @@ COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.out_entity_tab
|
|
|
1633
1690
|
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.out_installed_modules IS 'Output: array of installed module labels (e.g. ARRAY[''permissions_module:data_room'', ''memberships_module:data_room'', ''invites_module:data_room'']).
|
|
1634
1691
|
Populated by the trigger. Useful for verifying which modules were provisioned.';
|
|
1635
1692
|
|
|
1636
|
-
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
-
|
|
1646
|
-
-
|
|
1647
|
-
-
|
|
1648
|
-
-
|
|
1649
|
-
-
|
|
1650
|
-
-
|
|
1651
|
-
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.out_files_table_id IS 'Output: the UUID of the generated files table (e.g. data_room_files). Populated by the trigger when has_storage=true.';
|
|
1693
|
+
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.storage IS 'Optional JSON array of storage module definitions. Presence triggers provisioning
|
|
1694
|
+
(same inference model as namespaces, functions, agents).
|
|
1695
|
+
Each element provisions a separate storage module with its own tables
|
|
1696
|
+
({prefix}_{storage_key}_buckets/files), RLS policies, and feature flags.
|
|
1697
|
+
NULL = do not provision storage. ''[{}]'' = provision one default storage module.
|
|
1698
|
+
Each array element recognizes (all optional):
|
|
1699
|
+
- storage_key (text) module discriminator, max 16 chars, lowercase snake_case.
|
|
1700
|
+
Defaults to ''default'' (omitted from table names).
|
|
1701
|
+
Non-default keys become infixes: {prefix}_{key}_buckets.
|
|
1702
|
+
- upload_url_expiry_seconds (integer) presigned PUT URL expiry override
|
|
1703
|
+
- download_url_expiry_seconds (integer) presigned GET URL expiry override
|
|
1704
|
+
- default_max_file_size (bigint) global max file size in bytes for this module
|
|
1705
|
+
- allowed_origins (text[]) default CORS origins for all buckets in this module
|
|
1706
|
+
- restrict_reads (boolean) require read_files permission for SELECT on files
|
|
1707
|
+
- has_path_shares (boolean) enable virtual filesystem + path share policies
|
|
1708
|
+
- has_versioning (boolean) enable file version chains
|
|
1709
|
+
- has_content_hash (boolean) enable content hash for dedup
|
|
1710
|
+
- has_custom_keys (boolean) allow client-provided S3 keys
|
|
1711
|
+
- has_audit_log (boolean) enable file events audit table
|
|
1712
|
+
- has_confirm_upload (boolean) enable HeadObject confirmation flow
|
|
1713
|
+
- confirm_upload_delay (interval) delay before first confirmation attempt
|
|
1714
|
+
- buckets (jsonb[]) array of initial bucket definitions to seed.
|
|
1715
|
+
Each bucket: { name (required), description, is_public, allowed_mime_types, max_file_size, allowed_origins }
|
|
1716
|
+
- provisions (jsonb object) per-table customization keyed by "files" or "buckets".
|
|
1717
|
+
Each value: { nodes, fields, grants, use_rls, policies }.
|
|
1718
|
+
Example (single module, backward compat):
|
|
1719
|
+
storage := ''[{"buckets": [{"name": "documents"}]}]''::jsonb
|
|
1720
|
+
Example (multi-module):
|
|
1721
|
+
storage := ''[{"has_path_shares": true, "buckets": [{"name": "documents"}]}, {"storage_key": "fn", "has_custom_keys": true, "buckets": [{"name": "functions"}]}]''::jsonb';
|
|
1722
|
+
|
|
1723
|
+
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.out_storage_module_id IS 'Output: the UUID of the storage_module row created for this entity type. Populated by the trigger when storage is non-NULL and non-empty.';
|
|
1724
|
+
|
|
1725
|
+
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.out_buckets_table_id IS 'Output: the UUID of the generated buckets table (e.g. data_room_buckets). Populated by the trigger when storage is non-NULL and non-empty.';
|
|
1726
|
+
|
|
1727
|
+
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.out_files_table_id IS 'Output: the UUID of the generated files table (e.g. data_room_files). Populated by the trigger when storage is non-NULL and non-empty.';
|
|
1672
1728
|
|
|
1673
1729
|
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.out_invites_module_id IS 'Output: the UUID of the invites_module row created for this entity type. Populated by the trigger when has_invites=true.
|
|
1674
1730
|
NULL when has_invites=false, or when re-provisioning hits ON CONFLICT DO NOTHING
|
|
1675
1731
|
(i.e. the invites_module row was created in a previous run).';
|
|
1676
1732
|
|
|
1733
|
+
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.namespaces IS 'Optional JSON array of namespace module definitions. Presence triggers provisioning.
|
|
1734
|
+
NULL = do not provision namespaces. ''[{}]'' = provision one default namespace module.
|
|
1735
|
+
Each element recognizes (all optional):
|
|
1736
|
+
- key (text) module discriminator. Defaults to ''default''.
|
|
1737
|
+
- policies (jsonb array) RLS policy overrides. NULL = apply defaults from apply_namespace_security().
|
|
1738
|
+
Creates {prefix}_namespaces (or {prefix}_{key}_namespaces for non-default keys)
|
|
1739
|
+
with entity-scoped RLS (AuthzEntityMembership) and a rename proxy trigger.
|
|
1740
|
+
Registers manage_namespaces permission bit on first provision.
|
|
1741
|
+
Example: namespaces := ''[{}]''::jsonb';
|
|
1742
|
+
|
|
1743
|
+
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.functions IS 'Optional JSON array of function module definitions. Presence triggers provisioning.
|
|
1744
|
+
NULL = do not provision functions. ''[{}]'' = provision one default function module.
|
|
1745
|
+
Each element recognizes (all optional):
|
|
1746
|
+
- key (text) module discriminator. Defaults to ''default''.
|
|
1747
|
+
- policies (jsonb array) RLS policy overrides. NULL = apply defaults from apply_function_security().
|
|
1748
|
+
Creates {prefix}_function_definitions (or {prefix}_{key}_function_definitions for non-default keys)
|
|
1749
|
+
with entity-scoped RLS and a job trigger dispatching function:provision tasks.
|
|
1750
|
+
Registers manage_functions + invoke_functions permission bits on first provision.
|
|
1751
|
+
Example: functions := ''[{}]''::jsonb';
|
|
1752
|
+
|
|
1753
|
+
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.graphs IS 'Optional JSON array of graph module definitions. Presence triggers provisioning.
|
|
1754
|
+
NULL = do not provision graphs. ''[{}]'' = provision one default graph module.
|
|
1755
|
+
Each element recognizes (all optional):
|
|
1756
|
+
- key (text) module discriminator. Defaults to ''default''.
|
|
1757
|
+
- policies (jsonb array) RLS policy overrides. NULL = apply defaults from apply_graph_security().
|
|
1758
|
+
Registers manage_graphs + execute_graphs permission bits on first provision.
|
|
1759
|
+
Graph module requires a merkle_store_module_id dependency, so entity_type_provision
|
|
1760
|
+
only registers permissions here. The graph module itself must be provisioned
|
|
1761
|
+
separately with the merkle store dependency resolved.
|
|
1762
|
+
Example: graphs := ''[{}]''::jsonb';
|
|
1763
|
+
|
|
1764
|
+
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.out_namespace_module_id IS 'Output: the UUID of the namespace_module row created (or found) for this entity type.
|
|
1765
|
+
Populated by the trigger when namespaces is non-NULL. NULL otherwise.';
|
|
1766
|
+
|
|
1767
|
+
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.out_namespaces_table_id IS 'Output: the UUID of the generated namespaces table (e.g. data_room_namespaces).
|
|
1768
|
+
Populated by the trigger when namespaces is non-NULL. NULL otherwise.';
|
|
1769
|
+
|
|
1770
|
+
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.out_namespace_events_table_id IS 'Output: the UUID of the generated namespace_events partitioned table (e.g. data_room_namespace_events).
|
|
1771
|
+
Monthly partitioned, 12-month retention. Populated by the trigger when namespaces is non-NULL. NULL otherwise.';
|
|
1772
|
+
|
|
1677
1773
|
CREATE TABLE metaschema_modules_public.rate_limits_module (
|
|
1678
1774
|
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
1679
1775
|
database_id uuid NOT NULL,
|
|
@@ -1694,15 +1790,15 @@ CREATE TABLE metaschema_modules_public.rate_limits_module (
|
|
|
1694
1790
|
ON DELETE CASCADE,
|
|
1695
1791
|
CONSTRAINT rate_limit_settings_table_fkey
|
|
1696
1792
|
FOREIGN KEY(rate_limit_settings_table_id)
|
|
1697
|
-
REFERENCES metaschema_public.
|
|
1793
|
+
REFERENCES metaschema_public.table (id)
|
|
1698
1794
|
ON DELETE CASCADE,
|
|
1699
1795
|
CONSTRAINT ip_rate_limits_table_fkey
|
|
1700
1796
|
FOREIGN KEY(ip_rate_limits_table_id)
|
|
1701
|
-
REFERENCES metaschema_public.
|
|
1797
|
+
REFERENCES metaschema_public.table (id)
|
|
1702
1798
|
ON DELETE CASCADE,
|
|
1703
1799
|
CONSTRAINT rate_limits_table_fkey
|
|
1704
1800
|
FOREIGN KEY(rate_limits_table_id)
|
|
1705
|
-
REFERENCES metaschema_public.
|
|
1801
|
+
REFERENCES metaschema_public.table (id)
|
|
1706
1802
|
ON DELETE CASCADE,
|
|
1707
1803
|
CONSTRAINT rate_limits_module_database_id_uniq
|
|
1708
1804
|
UNIQUE (database_id)
|
|
@@ -1734,11 +1830,11 @@ CREATE TABLE metaschema_modules_public.devices_module (
|
|
|
1734
1830
|
ON DELETE CASCADE,
|
|
1735
1831
|
CONSTRAINT user_devices_table_fkey
|
|
1736
1832
|
FOREIGN KEY(user_devices_table_id)
|
|
1737
|
-
REFERENCES metaschema_public.
|
|
1833
|
+
REFERENCES metaschema_public.table (id)
|
|
1738
1834
|
ON DELETE CASCADE,
|
|
1739
1835
|
CONSTRAINT device_settings_table_fkey
|
|
1740
1836
|
FOREIGN KEY(device_settings_table_id)
|
|
1741
|
-
REFERENCES metaschema_public.
|
|
1837
|
+
REFERENCES metaschema_public.table (id)
|
|
1742
1838
|
ON DELETE CASCADE,
|
|
1743
1839
|
CONSTRAINT devices_module_database_id_uniq
|
|
1744
1840
|
UNIQUE (database_id)
|
|
@@ -1767,11 +1863,11 @@ CREATE TABLE metaschema_modules_public.session_secrets_module (
|
|
|
1767
1863
|
ON DELETE CASCADE,
|
|
1768
1864
|
CONSTRAINT table_fkey
|
|
1769
1865
|
FOREIGN KEY(table_id)
|
|
1770
|
-
REFERENCES metaschema_public.
|
|
1866
|
+
REFERENCES metaschema_public.table (id)
|
|
1771
1867
|
ON DELETE CASCADE,
|
|
1772
1868
|
CONSTRAINT sessions_table_fkey
|
|
1773
1869
|
FOREIGN KEY(sessions_table_id)
|
|
1774
|
-
REFERENCES metaschema_public.
|
|
1870
|
+
REFERENCES metaschema_public.table (id)
|
|
1775
1871
|
ON DELETE CASCADE
|
|
1776
1872
|
);
|
|
1777
1873
|
|
|
@@ -1801,11 +1897,11 @@ CREATE TABLE metaschema_modules_public.webauthn_credentials_module (
|
|
|
1801
1897
|
ON DELETE CASCADE,
|
|
1802
1898
|
CONSTRAINT table_fkey
|
|
1803
1899
|
FOREIGN KEY(table_id)
|
|
1804
|
-
REFERENCES metaschema_public.
|
|
1900
|
+
REFERENCES metaschema_public.table (id)
|
|
1805
1901
|
ON DELETE CASCADE,
|
|
1806
1902
|
CONSTRAINT owner_table_fkey
|
|
1807
1903
|
FOREIGN KEY(owner_table_id)
|
|
1808
|
-
REFERENCES metaschema_public.
|
|
1904
|
+
REFERENCES metaschema_public.table (id)
|
|
1809
1905
|
ON DELETE CASCADE,
|
|
1810
1906
|
CONSTRAINT schema_fkey
|
|
1811
1907
|
FOREIGN KEY(schema_id)
|
|
@@ -1850,27 +1946,27 @@ CREATE TABLE metaschema_modules_public.webauthn_auth_module (
|
|
|
1850
1946
|
ON DELETE CASCADE,
|
|
1851
1947
|
CONSTRAINT users_table_fkey
|
|
1852
1948
|
FOREIGN KEY(users_table_id)
|
|
1853
|
-
REFERENCES metaschema_public.
|
|
1949
|
+
REFERENCES metaschema_public.table (id)
|
|
1854
1950
|
ON DELETE CASCADE,
|
|
1855
1951
|
CONSTRAINT credentials_table_fkey
|
|
1856
1952
|
FOREIGN KEY(credentials_table_id)
|
|
1857
|
-
REFERENCES metaschema_public.
|
|
1953
|
+
REFERENCES metaschema_public.table (id)
|
|
1858
1954
|
ON DELETE CASCADE,
|
|
1859
1955
|
CONSTRAINT sessions_table_fkey
|
|
1860
1956
|
FOREIGN KEY(sessions_table_id)
|
|
1861
|
-
REFERENCES metaschema_public.
|
|
1957
|
+
REFERENCES metaschema_public.table (id)
|
|
1862
1958
|
ON DELETE CASCADE,
|
|
1863
1959
|
CONSTRAINT session_credentials_table_fkey
|
|
1864
1960
|
FOREIGN KEY(session_credentials_table_id)
|
|
1865
|
-
REFERENCES metaschema_public.
|
|
1961
|
+
REFERENCES metaschema_public.table (id)
|
|
1866
1962
|
ON DELETE CASCADE,
|
|
1867
1963
|
CONSTRAINT session_secrets_table_fkey
|
|
1868
1964
|
FOREIGN KEY(session_secrets_table_id)
|
|
1869
|
-
REFERENCES metaschema_public.
|
|
1965
|
+
REFERENCES metaschema_public.table (id)
|
|
1870
1966
|
ON DELETE CASCADE,
|
|
1871
1967
|
CONSTRAINT auth_settings_table_fkey
|
|
1872
1968
|
FOREIGN KEY(auth_settings_table_id)
|
|
1873
|
-
REFERENCES metaschema_public.
|
|
1969
|
+
REFERENCES metaschema_public.table (id)
|
|
1874
1970
|
ON DELETE CASCADE
|
|
1875
1971
|
);
|
|
1876
1972
|
|
|
@@ -1889,7 +1985,7 @@ CREATE TABLE metaschema_modules_public.identity_providers_module (
|
|
|
1889
1985
|
ON DELETE CASCADE,
|
|
1890
1986
|
CONSTRAINT table_fkey
|
|
1891
1987
|
FOREIGN KEY(table_id)
|
|
1892
|
-
REFERENCES metaschema_public.
|
|
1988
|
+
REFERENCES metaschema_public.table (id)
|
|
1893
1989
|
ON DELETE CASCADE,
|
|
1894
1990
|
CONSTRAINT schema_fkey
|
|
1895
1991
|
FOREIGN KEY(schema_id)
|
|
@@ -1937,35 +2033,35 @@ CREATE TABLE metaschema_modules_public.notifications_module (
|
|
|
1937
2033
|
ON DELETE CASCADE,
|
|
1938
2034
|
CONSTRAINT notifications_table_fkey
|
|
1939
2035
|
FOREIGN KEY(notifications_table_id)
|
|
1940
|
-
REFERENCES metaschema_public.
|
|
2036
|
+
REFERENCES metaschema_public.table (id)
|
|
1941
2037
|
ON DELETE CASCADE,
|
|
1942
2038
|
CONSTRAINT read_state_table_fkey
|
|
1943
2039
|
FOREIGN KEY(read_state_table_id)
|
|
1944
|
-
REFERENCES metaschema_public.
|
|
2040
|
+
REFERENCES metaschema_public.table (id)
|
|
1945
2041
|
ON DELETE CASCADE,
|
|
1946
2042
|
CONSTRAINT preferences_table_fkey
|
|
1947
2043
|
FOREIGN KEY(preferences_table_id)
|
|
1948
|
-
REFERENCES metaschema_public.
|
|
2044
|
+
REFERENCES metaschema_public.table (id)
|
|
1949
2045
|
ON DELETE SET NULL,
|
|
1950
2046
|
CONSTRAINT channels_table_fkey
|
|
1951
2047
|
FOREIGN KEY(channels_table_id)
|
|
1952
|
-
REFERENCES metaschema_public.
|
|
2048
|
+
REFERENCES metaschema_public.table (id)
|
|
1953
2049
|
ON DELETE SET NULL,
|
|
1954
2050
|
CONSTRAINT delivery_log_table_fkey
|
|
1955
2051
|
FOREIGN KEY(delivery_log_table_id)
|
|
1956
|
-
REFERENCES metaschema_public.
|
|
2052
|
+
REFERENCES metaschema_public.table (id)
|
|
1957
2053
|
ON DELETE SET NULL,
|
|
1958
2054
|
CONSTRAINT owner_table_fkey
|
|
1959
2055
|
FOREIGN KEY(owner_table_id)
|
|
1960
|
-
REFERENCES metaschema_public.
|
|
2056
|
+
REFERENCES metaschema_public.table (id)
|
|
1961
2057
|
ON DELETE CASCADE,
|
|
1962
2058
|
CONSTRAINT user_settings_table_fkey
|
|
1963
2059
|
FOREIGN KEY(user_settings_table_id)
|
|
1964
|
-
REFERENCES metaschema_public.
|
|
2060
|
+
REFERENCES metaschema_public.table (id)
|
|
1965
2061
|
ON DELETE SET NULL,
|
|
1966
2062
|
CONSTRAINT organization_settings_table_fkey
|
|
1967
2063
|
FOREIGN KEY(organization_settings_table_id)
|
|
1968
|
-
REFERENCES metaschema_public.
|
|
2064
|
+
REFERENCES metaschema_public.table (id)
|
|
1969
2065
|
ON DELETE SET NULL,
|
|
1970
2066
|
CONSTRAINT schema_fkey
|
|
1971
2067
|
FOREIGN KEY(schema_id)
|
|
@@ -2036,19 +2132,19 @@ CREATE TABLE metaschema_modules_public.plans_module (
|
|
|
2036
2132
|
ON DELETE CASCADE,
|
|
2037
2133
|
CONSTRAINT plans_table_fkey
|
|
2038
2134
|
FOREIGN KEY(plans_table_id)
|
|
2039
|
-
REFERENCES metaschema_public.
|
|
2135
|
+
REFERENCES metaschema_public.table (id)
|
|
2040
2136
|
ON DELETE CASCADE,
|
|
2041
2137
|
CONSTRAINT plan_limits_table_fkey
|
|
2042
2138
|
FOREIGN KEY(plan_limits_table_id)
|
|
2043
|
-
REFERENCES metaschema_public.
|
|
2139
|
+
REFERENCES metaschema_public.table (id)
|
|
2044
2140
|
ON DELETE CASCADE,
|
|
2045
2141
|
CONSTRAINT plan_pricing_table_fkey
|
|
2046
2142
|
FOREIGN KEY(plan_pricing_table_id)
|
|
2047
|
-
REFERENCES metaschema_public.
|
|
2143
|
+
REFERENCES metaschema_public.table (id)
|
|
2048
2144
|
ON DELETE CASCADE,
|
|
2049
2145
|
CONSTRAINT plan_overrides_table_fkey
|
|
2050
2146
|
FOREIGN KEY(plan_overrides_table_id)
|
|
2051
|
-
REFERENCES metaschema_public.
|
|
2147
|
+
REFERENCES metaschema_public.table (id)
|
|
2052
2148
|
ON DELETE CASCADE,
|
|
2053
2149
|
CONSTRAINT plans_module_database_id_unique
|
|
2054
2150
|
UNIQUE (database_id)
|
|
@@ -2069,6 +2165,10 @@ CREATE TABLE metaschema_modules_public.billing_module (
|
|
|
2069
2165
|
ledger_table_name text NOT NULL DEFAULT '',
|
|
2070
2166
|
balances_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2071
2167
|
balances_table_name text NOT NULL DEFAULT '',
|
|
2168
|
+
meter_credits_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2169
|
+
meter_credits_table_name text NOT NULL DEFAULT '',
|
|
2170
|
+
meter_sources_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2171
|
+
meter_sources_table_name text NOT NULL DEFAULT '',
|
|
2072
2172
|
record_usage_function text NOT NULL DEFAULT '',
|
|
2073
2173
|
prefix text NULL,
|
|
2074
2174
|
CONSTRAINT db_fkey
|
|
@@ -2085,19 +2185,27 @@ CREATE TABLE metaschema_modules_public.billing_module (
|
|
|
2085
2185
|
ON DELETE CASCADE,
|
|
2086
2186
|
CONSTRAINT meters_table_fkey
|
|
2087
2187
|
FOREIGN KEY(meters_table_id)
|
|
2088
|
-
REFERENCES metaschema_public.
|
|
2188
|
+
REFERENCES metaschema_public.table (id)
|
|
2089
2189
|
ON DELETE CASCADE,
|
|
2090
2190
|
CONSTRAINT plan_subscriptions_table_fkey
|
|
2091
2191
|
FOREIGN KEY(plan_subscriptions_table_id)
|
|
2092
|
-
REFERENCES metaschema_public.
|
|
2192
|
+
REFERENCES metaschema_public.table (id)
|
|
2093
2193
|
ON DELETE CASCADE,
|
|
2094
2194
|
CONSTRAINT ledger_table_fkey
|
|
2095
2195
|
FOREIGN KEY(ledger_table_id)
|
|
2096
|
-
REFERENCES metaschema_public.
|
|
2196
|
+
REFERENCES metaschema_public.table (id)
|
|
2097
2197
|
ON DELETE CASCADE,
|
|
2098
2198
|
CONSTRAINT balances_table_fkey
|
|
2099
2199
|
FOREIGN KEY(balances_table_id)
|
|
2100
|
-
REFERENCES metaschema_public.
|
|
2200
|
+
REFERENCES metaschema_public.table (id)
|
|
2201
|
+
ON DELETE CASCADE,
|
|
2202
|
+
CONSTRAINT meter_credits_table_fkey
|
|
2203
|
+
FOREIGN KEY(meter_credits_table_id)
|
|
2204
|
+
REFERENCES metaschema_public.table (id)
|
|
2205
|
+
ON DELETE CASCADE,
|
|
2206
|
+
CONSTRAINT meter_sources_table_fkey
|
|
2207
|
+
FOREIGN KEY(meter_sources_table_id)
|
|
2208
|
+
REFERENCES metaschema_public.table (id)
|
|
2101
2209
|
ON DELETE CASCADE,
|
|
2102
2210
|
CONSTRAINT billing_module_database_id_unique
|
|
2103
2211
|
UNIQUE (database_id)
|
|
@@ -2140,35 +2248,35 @@ CREATE TABLE metaschema_modules_public.billing_provider_module (
|
|
|
2140
2248
|
ON DELETE CASCADE,
|
|
2141
2249
|
CONSTRAINT billing_customers_table_fkey
|
|
2142
2250
|
FOREIGN KEY(billing_customers_table_id)
|
|
2143
|
-
REFERENCES metaschema_public.
|
|
2251
|
+
REFERENCES metaschema_public.table (id)
|
|
2144
2252
|
ON DELETE CASCADE,
|
|
2145
2253
|
CONSTRAINT billing_products_table_fkey
|
|
2146
2254
|
FOREIGN KEY(billing_products_table_id)
|
|
2147
|
-
REFERENCES metaschema_public.
|
|
2255
|
+
REFERENCES metaschema_public.table (id)
|
|
2148
2256
|
ON DELETE CASCADE,
|
|
2149
2257
|
CONSTRAINT billing_prices_table_fkey
|
|
2150
2258
|
FOREIGN KEY(billing_prices_table_id)
|
|
2151
|
-
REFERENCES metaschema_public.
|
|
2259
|
+
REFERENCES metaschema_public.table (id)
|
|
2152
2260
|
ON DELETE CASCADE,
|
|
2153
2261
|
CONSTRAINT billing_subscriptions_table_fkey
|
|
2154
2262
|
FOREIGN KEY(billing_subscriptions_table_id)
|
|
2155
|
-
REFERENCES metaschema_public.
|
|
2263
|
+
REFERENCES metaschema_public.table (id)
|
|
2156
2264
|
ON DELETE CASCADE,
|
|
2157
2265
|
CONSTRAINT billing_webhook_events_table_fkey
|
|
2158
2266
|
FOREIGN KEY(billing_webhook_events_table_id)
|
|
2159
|
-
REFERENCES metaschema_public.
|
|
2267
|
+
REFERENCES metaschema_public.table (id)
|
|
2160
2268
|
ON DELETE CASCADE,
|
|
2161
2269
|
CONSTRAINT products_table_fkey
|
|
2162
2270
|
FOREIGN KEY(products_table_id)
|
|
2163
|
-
REFERENCES metaschema_public.
|
|
2271
|
+
REFERENCES metaschema_public.table (id)
|
|
2164
2272
|
ON DELETE SET NULL,
|
|
2165
2273
|
CONSTRAINT prices_table_fkey
|
|
2166
2274
|
FOREIGN KEY(prices_table_id)
|
|
2167
|
-
REFERENCES metaschema_public.
|
|
2275
|
+
REFERENCES metaschema_public.table (id)
|
|
2168
2276
|
ON DELETE SET NULL,
|
|
2169
2277
|
CONSTRAINT subscriptions_table_fkey
|
|
2170
2278
|
FOREIGN KEY(subscriptions_table_id)
|
|
2171
|
-
REFERENCES metaschema_public.
|
|
2279
|
+
REFERENCES metaschema_public.table (id)
|
|
2172
2280
|
ON DELETE SET NULL,
|
|
2173
2281
|
CONSTRAINT billing_provider_module_database_id_unique
|
|
2174
2282
|
UNIQUE (database_id)
|
|
@@ -2186,8 +2294,8 @@ CREATE TABLE metaschema_modules_public.realtime_module (
|
|
|
2186
2294
|
listener_node_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2187
2295
|
source_registry_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2188
2296
|
retention_hours int NOT NULL DEFAULT 168,
|
|
2189
|
-
|
|
2190
|
-
|
|
2297
|
+
premake int NOT NULL DEFAULT 7,
|
|
2298
|
+
"interval" text NOT NULL DEFAULT '1 day',
|
|
2191
2299
|
notify_channel text NULL,
|
|
2192
2300
|
CONSTRAINT db_fkey
|
|
2193
2301
|
FOREIGN KEY(database_id)
|
|
@@ -2207,15 +2315,15 @@ CREATE TABLE metaschema_modules_public.realtime_module (
|
|
|
2207
2315
|
ON DELETE CASCADE,
|
|
2208
2316
|
CONSTRAINT change_log_table_fkey
|
|
2209
2317
|
FOREIGN KEY(change_log_table_id)
|
|
2210
|
-
REFERENCES metaschema_public.
|
|
2318
|
+
REFERENCES metaschema_public.table (id)
|
|
2211
2319
|
ON DELETE CASCADE,
|
|
2212
2320
|
CONSTRAINT listener_node_table_fkey
|
|
2213
2321
|
FOREIGN KEY(listener_node_table_id)
|
|
2214
|
-
REFERENCES metaschema_public.
|
|
2322
|
+
REFERENCES metaschema_public.table (id)
|
|
2215
2323
|
ON DELETE CASCADE,
|
|
2216
2324
|
CONSTRAINT source_registry_table_fkey
|
|
2217
2325
|
FOREIGN KEY(source_registry_table_id)
|
|
2218
|
-
REFERENCES metaschema_public.
|
|
2326
|
+
REFERENCES metaschema_public.table (id)
|
|
2219
2327
|
ON DELETE CASCADE
|
|
2220
2328
|
);
|
|
2221
2329
|
|
|
@@ -2233,4 +2341,567 @@ CREATE INDEX realtime_module_change_log_table_id_idx ON metaschema_modules_publi
|
|
|
2233
2341
|
|
|
2234
2342
|
CREATE INDEX realtime_module_listener_node_table_id_idx ON metaschema_modules_public.realtime_module (listener_node_table_id);
|
|
2235
2343
|
|
|
2236
|
-
CREATE INDEX realtime_module_source_registry_table_id_idx ON metaschema_modules_public.realtime_module (source_registry_table_id);
|
|
2344
|
+
CREATE INDEX realtime_module_source_registry_table_id_idx ON metaschema_modules_public.realtime_module (source_registry_table_id);
|
|
2345
|
+
|
|
2346
|
+
CREATE TABLE metaschema_modules_public.rate_limit_meters_module (
|
|
2347
|
+
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
2348
|
+
database_id uuid NOT NULL,
|
|
2349
|
+
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2350
|
+
private_schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2351
|
+
rate_limit_state_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2352
|
+
rate_limit_state_table_name text NOT NULL DEFAULT '',
|
|
2353
|
+
rate_limit_overrides_table_id uuid NULL,
|
|
2354
|
+
rate_limit_overrides_table_name text NOT NULL DEFAULT '',
|
|
2355
|
+
rate_window_limits_table_id uuid NULL,
|
|
2356
|
+
rate_window_limits_table_name text NOT NULL DEFAULT '',
|
|
2357
|
+
check_rate_limit_function text NOT NULL DEFAULT '',
|
|
2358
|
+
prefix text NULL,
|
|
2359
|
+
CONSTRAINT db_fkey
|
|
2360
|
+
FOREIGN KEY(database_id)
|
|
2361
|
+
REFERENCES metaschema_public.database (id)
|
|
2362
|
+
ON DELETE CASCADE,
|
|
2363
|
+
CONSTRAINT schema_fkey
|
|
2364
|
+
FOREIGN KEY(schema_id)
|
|
2365
|
+
REFERENCES metaschema_public.schema (id)
|
|
2366
|
+
ON DELETE CASCADE,
|
|
2367
|
+
CONSTRAINT private_schema_fkey
|
|
2368
|
+
FOREIGN KEY(private_schema_id)
|
|
2369
|
+
REFERENCES metaschema_public.schema (id)
|
|
2370
|
+
ON DELETE CASCADE,
|
|
2371
|
+
CONSTRAINT rate_limit_state_table_fkey
|
|
2372
|
+
FOREIGN KEY(rate_limit_state_table_id)
|
|
2373
|
+
REFERENCES metaschema_public.table (id)
|
|
2374
|
+
ON DELETE CASCADE,
|
|
2375
|
+
CONSTRAINT rate_limit_overrides_table_fkey
|
|
2376
|
+
FOREIGN KEY(rate_limit_overrides_table_id)
|
|
2377
|
+
REFERENCES metaschema_public.table (id)
|
|
2378
|
+
ON DELETE CASCADE,
|
|
2379
|
+
CONSTRAINT rate_window_limits_table_fkey
|
|
2380
|
+
FOREIGN KEY(rate_window_limits_table_id)
|
|
2381
|
+
REFERENCES metaschema_public.table (id)
|
|
2382
|
+
ON DELETE CASCADE,
|
|
2383
|
+
CONSTRAINT rate_limit_meters_module_database_id_unique
|
|
2384
|
+
UNIQUE (database_id)
|
|
2385
|
+
);
|
|
2386
|
+
|
|
2387
|
+
CREATE INDEX rate_limit_meters_module_database_id_idx ON metaschema_modules_public.rate_limit_meters_module (database_id);
|
|
2388
|
+
|
|
2389
|
+
COMMENT ON CONSTRAINT rate_limit_state_table_fkey ON metaschema_modules_public.rate_limit_meters_module IS '@fieldName rateLimitStateTableByRateLimitStateTableId';
|
|
2390
|
+
|
|
2391
|
+
COMMENT ON CONSTRAINT rate_limit_overrides_table_fkey ON metaschema_modules_public.rate_limit_meters_module IS '@fieldName rateLimitOverridesTableByRateLimitOverridesTableId';
|
|
2392
|
+
|
|
2393
|
+
COMMENT ON CONSTRAINT rate_window_limits_table_fkey ON metaschema_modules_public.rate_limit_meters_module IS '@fieldName rateWindowLimitsTableByRateWindowLimitsTableId';
|
|
2394
|
+
|
|
2395
|
+
CREATE TABLE metaschema_modules_public.config_secrets_org_module (
|
|
2396
|
+
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
2397
|
+
database_id uuid NOT NULL,
|
|
2398
|
+
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2399
|
+
table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2400
|
+
table_name text NOT NULL DEFAULT 'org_secrets',
|
|
2401
|
+
CONSTRAINT db_fkey
|
|
2402
|
+
FOREIGN KEY(database_id)
|
|
2403
|
+
REFERENCES metaschema_public.database (id)
|
|
2404
|
+
ON DELETE CASCADE,
|
|
2405
|
+
CONSTRAINT schema_fkey
|
|
2406
|
+
FOREIGN KEY(schema_id)
|
|
2407
|
+
REFERENCES metaschema_public.schema (id)
|
|
2408
|
+
ON DELETE CASCADE,
|
|
2409
|
+
CONSTRAINT table_fkey
|
|
2410
|
+
FOREIGN KEY(table_id)
|
|
2411
|
+
REFERENCES metaschema_public.table (id)
|
|
2412
|
+
ON DELETE CASCADE
|
|
2413
|
+
);
|
|
2414
|
+
|
|
2415
|
+
CREATE INDEX config_secrets_org_module_database_id_idx ON metaschema_modules_public.config_secrets_org_module (database_id);
|
|
2416
|
+
|
|
2417
|
+
CREATE INDEX config_secrets_org_module_schema_id_idx ON metaschema_modules_public.config_secrets_org_module (schema_id);
|
|
2418
|
+
|
|
2419
|
+
CREATE INDEX config_secrets_org_module_table_id_idx ON metaschema_modules_public.config_secrets_org_module (table_id);
|
|
2420
|
+
|
|
2421
|
+
COMMENT ON TABLE metaschema_modules_public.config_secrets_org_module IS 'Config row for the config_secrets_org_module, which provisions an organization-scoped encrypted key-value secrets store with manage_secrets permission and entity-membership RLS.';
|
|
2422
|
+
|
|
2423
|
+
CREATE TABLE metaschema_modules_public.inference_log_module (
|
|
2424
|
+
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
2425
|
+
database_id uuid NOT NULL,
|
|
2426
|
+
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2427
|
+
private_schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2428
|
+
inference_log_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2429
|
+
inference_log_table_name text NOT NULL DEFAULT '',
|
|
2430
|
+
usage_daily_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2431
|
+
usage_daily_table_name text NOT NULL DEFAULT '',
|
|
2432
|
+
"interval" text NOT NULL DEFAULT '1 month',
|
|
2433
|
+
retention text NOT NULL DEFAULT '12 months',
|
|
2434
|
+
premake int NOT NULL DEFAULT 2,
|
|
2435
|
+
scope text NOT NULL DEFAULT 'app',
|
|
2436
|
+
actor_fk_table_id uuid NULL,
|
|
2437
|
+
entity_fk_table_id uuid NULL,
|
|
2438
|
+
prefix text NULL,
|
|
2439
|
+
CONSTRAINT db_fkey
|
|
2440
|
+
FOREIGN KEY(database_id)
|
|
2441
|
+
REFERENCES metaschema_public.database (id)
|
|
2442
|
+
ON DELETE CASCADE,
|
|
2443
|
+
CONSTRAINT schema_fkey
|
|
2444
|
+
FOREIGN KEY(schema_id)
|
|
2445
|
+
REFERENCES metaschema_public.schema (id)
|
|
2446
|
+
ON DELETE CASCADE,
|
|
2447
|
+
CONSTRAINT private_schema_fkey
|
|
2448
|
+
FOREIGN KEY(private_schema_id)
|
|
2449
|
+
REFERENCES metaschema_public.schema (id)
|
|
2450
|
+
ON DELETE CASCADE,
|
|
2451
|
+
CONSTRAINT inference_log_table_fkey
|
|
2452
|
+
FOREIGN KEY(inference_log_table_id)
|
|
2453
|
+
REFERENCES metaschema_public.table (id)
|
|
2454
|
+
ON DELETE CASCADE,
|
|
2455
|
+
CONSTRAINT usage_daily_table_fkey
|
|
2456
|
+
FOREIGN KEY(usage_daily_table_id)
|
|
2457
|
+
REFERENCES metaschema_public.table (id)
|
|
2458
|
+
ON DELETE CASCADE,
|
|
2459
|
+
CONSTRAINT inference_log_module_database_id_prefix_unique
|
|
2460
|
+
UNIQUE NULLS NOT DISTINCT (database_id, prefix)
|
|
2461
|
+
);
|
|
2462
|
+
|
|
2463
|
+
CREATE INDEX inference_log_module_database_id_idx ON metaschema_modules_public.inference_log_module (database_id);
|
|
2464
|
+
|
|
2465
|
+
CREATE TABLE metaschema_modules_public.compute_log_module (
|
|
2466
|
+
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
2467
|
+
database_id uuid NOT NULL,
|
|
2468
|
+
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2469
|
+
private_schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2470
|
+
compute_log_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2471
|
+
compute_log_table_name text NOT NULL DEFAULT '',
|
|
2472
|
+
usage_daily_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2473
|
+
usage_daily_table_name text NOT NULL DEFAULT '',
|
|
2474
|
+
"interval" text NOT NULL DEFAULT '1 month',
|
|
2475
|
+
retention text NOT NULL DEFAULT '12 months',
|
|
2476
|
+
premake int NOT NULL DEFAULT 2,
|
|
2477
|
+
scope text NOT NULL DEFAULT 'app',
|
|
2478
|
+
actor_fk_table_id uuid NULL,
|
|
2479
|
+
entity_fk_table_id uuid NULL,
|
|
2480
|
+
prefix text NULL,
|
|
2481
|
+
CONSTRAINT db_fkey
|
|
2482
|
+
FOREIGN KEY(database_id)
|
|
2483
|
+
REFERENCES metaschema_public.database (id)
|
|
2484
|
+
ON DELETE CASCADE,
|
|
2485
|
+
CONSTRAINT schema_fkey
|
|
2486
|
+
FOREIGN KEY(schema_id)
|
|
2487
|
+
REFERENCES metaschema_public.schema (id)
|
|
2488
|
+
ON DELETE CASCADE,
|
|
2489
|
+
CONSTRAINT private_schema_fkey
|
|
2490
|
+
FOREIGN KEY(private_schema_id)
|
|
2491
|
+
REFERENCES metaschema_public.schema (id)
|
|
2492
|
+
ON DELETE CASCADE,
|
|
2493
|
+
CONSTRAINT compute_log_table_fkey
|
|
2494
|
+
FOREIGN KEY(compute_log_table_id)
|
|
2495
|
+
REFERENCES metaschema_public.table (id)
|
|
2496
|
+
ON DELETE CASCADE,
|
|
2497
|
+
CONSTRAINT usage_daily_table_fkey
|
|
2498
|
+
FOREIGN KEY(usage_daily_table_id)
|
|
2499
|
+
REFERENCES metaschema_public.table (id)
|
|
2500
|
+
ON DELETE CASCADE,
|
|
2501
|
+
CONSTRAINT compute_log_module_database_id_prefix_unique
|
|
2502
|
+
UNIQUE NULLS NOT DISTINCT (database_id, prefix)
|
|
2503
|
+
);
|
|
2504
|
+
|
|
2505
|
+
CREATE INDEX compute_log_module_database_id_idx ON metaschema_modules_public.compute_log_module (database_id);
|
|
2506
|
+
|
|
2507
|
+
CREATE TABLE metaschema_modules_public.transfer_log_module (
|
|
2508
|
+
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
2509
|
+
database_id uuid NOT NULL,
|
|
2510
|
+
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2511
|
+
private_schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2512
|
+
transfer_log_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2513
|
+
transfer_log_table_name text NOT NULL DEFAULT '',
|
|
2514
|
+
usage_daily_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2515
|
+
usage_daily_table_name text NOT NULL DEFAULT '',
|
|
2516
|
+
"interval" text NOT NULL DEFAULT '1 month',
|
|
2517
|
+
retention text NOT NULL DEFAULT '12 months',
|
|
2518
|
+
premake int NOT NULL DEFAULT 2,
|
|
2519
|
+
scope text NOT NULL DEFAULT 'app',
|
|
2520
|
+
actor_fk_table_id uuid NULL,
|
|
2521
|
+
entity_fk_table_id uuid NULL,
|
|
2522
|
+
prefix text NULL,
|
|
2523
|
+
CONSTRAINT db_fkey
|
|
2524
|
+
FOREIGN KEY(database_id)
|
|
2525
|
+
REFERENCES metaschema_public.database (id)
|
|
2526
|
+
ON DELETE CASCADE,
|
|
2527
|
+
CONSTRAINT schema_fkey
|
|
2528
|
+
FOREIGN KEY(schema_id)
|
|
2529
|
+
REFERENCES metaschema_public.schema (id)
|
|
2530
|
+
ON DELETE CASCADE,
|
|
2531
|
+
CONSTRAINT private_schema_fkey
|
|
2532
|
+
FOREIGN KEY(private_schema_id)
|
|
2533
|
+
REFERENCES metaschema_public.schema (id)
|
|
2534
|
+
ON DELETE CASCADE,
|
|
2535
|
+
CONSTRAINT transfer_log_table_fkey
|
|
2536
|
+
FOREIGN KEY(transfer_log_table_id)
|
|
2537
|
+
REFERENCES metaschema_public.table (id)
|
|
2538
|
+
ON DELETE CASCADE,
|
|
2539
|
+
CONSTRAINT usage_daily_table_fkey
|
|
2540
|
+
FOREIGN KEY(usage_daily_table_id)
|
|
2541
|
+
REFERENCES metaschema_public.table (id)
|
|
2542
|
+
ON DELETE CASCADE,
|
|
2543
|
+
CONSTRAINT transfer_log_module_database_id_prefix_unique
|
|
2544
|
+
UNIQUE NULLS NOT DISTINCT (database_id, prefix)
|
|
2545
|
+
);
|
|
2546
|
+
|
|
2547
|
+
CREATE INDEX transfer_log_module_database_id_idx ON metaschema_modules_public.transfer_log_module (database_id);
|
|
2548
|
+
|
|
2549
|
+
CREATE TABLE metaschema_modules_public.storage_log_module (
|
|
2550
|
+
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
2551
|
+
database_id uuid NOT NULL,
|
|
2552
|
+
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2553
|
+
private_schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2554
|
+
storage_log_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2555
|
+
storage_log_table_name text NOT NULL DEFAULT '',
|
|
2556
|
+
usage_daily_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2557
|
+
usage_daily_table_name text NOT NULL DEFAULT '',
|
|
2558
|
+
"interval" text NOT NULL DEFAULT '1 month',
|
|
2559
|
+
retention text NOT NULL DEFAULT '12 months',
|
|
2560
|
+
premake int NOT NULL DEFAULT 2,
|
|
2561
|
+
scope text NOT NULL DEFAULT 'app',
|
|
2562
|
+
actor_fk_table_id uuid NULL,
|
|
2563
|
+
entity_fk_table_id uuid NULL,
|
|
2564
|
+
prefix text NULL,
|
|
2565
|
+
CONSTRAINT db_fkey
|
|
2566
|
+
FOREIGN KEY(database_id)
|
|
2567
|
+
REFERENCES metaschema_public.database (id)
|
|
2568
|
+
ON DELETE CASCADE,
|
|
2569
|
+
CONSTRAINT schema_fkey
|
|
2570
|
+
FOREIGN KEY(schema_id)
|
|
2571
|
+
REFERENCES metaschema_public.schema (id)
|
|
2572
|
+
ON DELETE CASCADE,
|
|
2573
|
+
CONSTRAINT private_schema_fkey
|
|
2574
|
+
FOREIGN KEY(private_schema_id)
|
|
2575
|
+
REFERENCES metaschema_public.schema (id)
|
|
2576
|
+
ON DELETE CASCADE,
|
|
2577
|
+
CONSTRAINT storage_log_table_fkey
|
|
2578
|
+
FOREIGN KEY(storage_log_table_id)
|
|
2579
|
+
REFERENCES metaschema_public.table (id)
|
|
2580
|
+
ON DELETE CASCADE,
|
|
2581
|
+
CONSTRAINT usage_daily_table_fkey
|
|
2582
|
+
FOREIGN KEY(usage_daily_table_id)
|
|
2583
|
+
REFERENCES metaschema_public.table (id)
|
|
2584
|
+
ON DELETE CASCADE,
|
|
2585
|
+
CONSTRAINT storage_log_module_database_id_prefix_unique
|
|
2586
|
+
UNIQUE NULLS NOT DISTINCT (database_id, prefix)
|
|
2587
|
+
);
|
|
2588
|
+
|
|
2589
|
+
CREATE INDEX storage_log_module_database_id_idx ON metaschema_modules_public.storage_log_module (database_id);
|
|
2590
|
+
|
|
2591
|
+
CREATE TABLE metaschema_modules_public.db_usage_module (
|
|
2592
|
+
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
2593
|
+
database_id uuid NOT NULL,
|
|
2594
|
+
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2595
|
+
private_schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2596
|
+
table_stats_log_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2597
|
+
table_stats_log_table_name text NOT NULL DEFAULT '',
|
|
2598
|
+
table_stats_daily_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2599
|
+
table_stats_daily_table_name text NOT NULL DEFAULT '',
|
|
2600
|
+
query_stats_log_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2601
|
+
query_stats_log_table_name text NOT NULL DEFAULT '',
|
|
2602
|
+
query_stats_daily_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2603
|
+
query_stats_daily_table_name text NOT NULL DEFAULT '',
|
|
2604
|
+
"interval" text NOT NULL DEFAULT '1 month',
|
|
2605
|
+
retention text NOT NULL DEFAULT '12 months',
|
|
2606
|
+
premake int NOT NULL DEFAULT 2,
|
|
2607
|
+
scope text NOT NULL DEFAULT 'app',
|
|
2608
|
+
prefix text NULL,
|
|
2609
|
+
CONSTRAINT db_fkey
|
|
2610
|
+
FOREIGN KEY(database_id)
|
|
2611
|
+
REFERENCES metaschema_public.database (id)
|
|
2612
|
+
ON DELETE CASCADE,
|
|
2613
|
+
CONSTRAINT schema_fkey
|
|
2614
|
+
FOREIGN KEY(schema_id)
|
|
2615
|
+
REFERENCES metaschema_public.schema (id)
|
|
2616
|
+
ON DELETE CASCADE,
|
|
2617
|
+
CONSTRAINT private_schema_fkey
|
|
2618
|
+
FOREIGN KEY(private_schema_id)
|
|
2619
|
+
REFERENCES metaschema_public.schema (id)
|
|
2620
|
+
ON DELETE CASCADE,
|
|
2621
|
+
CONSTRAINT table_stats_log_table_fkey
|
|
2622
|
+
FOREIGN KEY(table_stats_log_table_id)
|
|
2623
|
+
REFERENCES metaschema_public.table (id)
|
|
2624
|
+
ON DELETE CASCADE,
|
|
2625
|
+
CONSTRAINT table_stats_daily_table_fkey
|
|
2626
|
+
FOREIGN KEY(table_stats_daily_table_id)
|
|
2627
|
+
REFERENCES metaschema_public.table (id)
|
|
2628
|
+
ON DELETE CASCADE,
|
|
2629
|
+
CONSTRAINT query_stats_log_table_fkey
|
|
2630
|
+
FOREIGN KEY(query_stats_log_table_id)
|
|
2631
|
+
REFERENCES metaschema_public.table (id)
|
|
2632
|
+
ON DELETE CASCADE,
|
|
2633
|
+
CONSTRAINT query_stats_daily_table_fkey
|
|
2634
|
+
FOREIGN KEY(query_stats_daily_table_id)
|
|
2635
|
+
REFERENCES metaschema_public.table (id)
|
|
2636
|
+
ON DELETE CASCADE,
|
|
2637
|
+
CONSTRAINT db_usage_module_database_id_prefix_unique
|
|
2638
|
+
UNIQUE NULLS NOT DISTINCT (database_id, prefix)
|
|
2639
|
+
);
|
|
2640
|
+
|
|
2641
|
+
CREATE INDEX db_usage_module_database_id_idx ON metaschema_modules_public.db_usage_module (database_id);
|
|
2642
|
+
|
|
2643
|
+
CREATE TABLE metaschema_modules_public.agent_module (
|
|
2644
|
+
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
2645
|
+
database_id uuid NOT NULL,
|
|
2646
|
+
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2647
|
+
private_schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2648
|
+
thread_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2649
|
+
message_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2650
|
+
task_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2651
|
+
prompts_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2652
|
+
knowledge_table_id uuid DEFAULT NULL,
|
|
2653
|
+
thread_table_name text NOT NULL DEFAULT 'agent_thread',
|
|
2654
|
+
message_table_name text NOT NULL DEFAULT 'agent_message',
|
|
2655
|
+
task_table_name text NOT NULL DEFAULT 'agent_task',
|
|
2656
|
+
prompts_table_name text NOT NULL DEFAULT 'agent_prompt',
|
|
2657
|
+
knowledge_table_name text NOT NULL DEFAULT 'agent_knowledge',
|
|
2658
|
+
has_knowledge boolean NOT NULL DEFAULT false,
|
|
2659
|
+
api_name text DEFAULT 'agent',
|
|
2660
|
+
membership_type int DEFAULT NULL,
|
|
2661
|
+
entity_table_id uuid NULL,
|
|
2662
|
+
policies jsonb NULL,
|
|
2663
|
+
knowledge_config jsonb NULL,
|
|
2664
|
+
knowledge_policies jsonb NULL,
|
|
2665
|
+
provisions jsonb NULL,
|
|
2666
|
+
CONSTRAINT agent_module_db_fkey
|
|
2667
|
+
FOREIGN KEY(database_id)
|
|
2668
|
+
REFERENCES metaschema_public.database (id)
|
|
2669
|
+
ON DELETE CASCADE,
|
|
2670
|
+
CONSTRAINT agent_module_schema_fkey
|
|
2671
|
+
FOREIGN KEY(schema_id)
|
|
2672
|
+
REFERENCES metaschema_public.schema (id)
|
|
2673
|
+
ON DELETE CASCADE,
|
|
2674
|
+
CONSTRAINT agent_module_private_schema_fkey
|
|
2675
|
+
FOREIGN KEY(private_schema_id)
|
|
2676
|
+
REFERENCES metaschema_public.schema (id)
|
|
2677
|
+
ON DELETE CASCADE,
|
|
2678
|
+
CONSTRAINT agent_module_thread_table_fkey
|
|
2679
|
+
FOREIGN KEY(thread_table_id)
|
|
2680
|
+
REFERENCES metaschema_public.table (id)
|
|
2681
|
+
ON DELETE CASCADE,
|
|
2682
|
+
CONSTRAINT agent_module_message_table_fkey
|
|
2683
|
+
FOREIGN KEY(message_table_id)
|
|
2684
|
+
REFERENCES metaschema_public.table (id)
|
|
2685
|
+
ON DELETE CASCADE,
|
|
2686
|
+
CONSTRAINT agent_module_task_table_fkey
|
|
2687
|
+
FOREIGN KEY(task_table_id)
|
|
2688
|
+
REFERENCES metaschema_public.table (id)
|
|
2689
|
+
ON DELETE CASCADE,
|
|
2690
|
+
CONSTRAINT agent_module_prompts_table_fkey
|
|
2691
|
+
FOREIGN KEY(prompts_table_id)
|
|
2692
|
+
REFERENCES metaschema_public.table (id)
|
|
2693
|
+
ON DELETE CASCADE,
|
|
2694
|
+
CONSTRAINT agent_module_knowledge_table_fkey
|
|
2695
|
+
FOREIGN KEY(knowledge_table_id)
|
|
2696
|
+
REFERENCES metaschema_public.table (id)
|
|
2697
|
+
ON DELETE CASCADE,
|
|
2698
|
+
CONSTRAINT agent_module_entity_table_fkey
|
|
2699
|
+
FOREIGN KEY(entity_table_id)
|
|
2700
|
+
REFERENCES metaschema_public.table (id)
|
|
2701
|
+
ON DELETE CASCADE
|
|
2702
|
+
);
|
|
2703
|
+
|
|
2704
|
+
CREATE INDEX agent_module_database_id_idx ON metaschema_modules_public.agent_module (database_id);
|
|
2705
|
+
|
|
2706
|
+
CREATE UNIQUE INDEX agent_module_unique_scope ON metaschema_modules_public.agent_module (database_id, (COALESCE(membership_type, -1)));
|
|
2707
|
+
|
|
2708
|
+
CREATE TABLE metaschema_modules_public.merkle_store_module (
|
|
2709
|
+
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
2710
|
+
database_id uuid NOT NULL,
|
|
2711
|
+
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2712
|
+
public_schema_name text,
|
|
2713
|
+
object_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2714
|
+
store_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2715
|
+
commit_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2716
|
+
ref_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2717
|
+
prefix text NOT NULL DEFAULT '',
|
|
2718
|
+
api_name text,
|
|
2719
|
+
scope_field text NOT NULL DEFAULT 'scope_id',
|
|
2720
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
2721
|
+
CONSTRAINT db_fkey
|
|
2722
|
+
FOREIGN KEY(database_id)
|
|
2723
|
+
REFERENCES metaschema_public.database (id)
|
|
2724
|
+
ON DELETE CASCADE,
|
|
2725
|
+
CONSTRAINT schema_fkey
|
|
2726
|
+
FOREIGN KEY(schema_id)
|
|
2727
|
+
REFERENCES metaschema_public.schema (id)
|
|
2728
|
+
ON DELETE CASCADE,
|
|
2729
|
+
CONSTRAINT object_table_fkey
|
|
2730
|
+
FOREIGN KEY(object_table_id)
|
|
2731
|
+
REFERENCES metaschema_public.table (id)
|
|
2732
|
+
ON DELETE CASCADE,
|
|
2733
|
+
CONSTRAINT store_table_fkey
|
|
2734
|
+
FOREIGN KEY(store_table_id)
|
|
2735
|
+
REFERENCES metaschema_public.table (id)
|
|
2736
|
+
ON DELETE CASCADE,
|
|
2737
|
+
CONSTRAINT commit_table_fkey
|
|
2738
|
+
FOREIGN KEY(commit_table_id)
|
|
2739
|
+
REFERENCES metaschema_public.table (id)
|
|
2740
|
+
ON DELETE CASCADE,
|
|
2741
|
+
CONSTRAINT ref_table_fkey
|
|
2742
|
+
FOREIGN KEY(ref_table_id)
|
|
2743
|
+
REFERENCES metaschema_public.table (id)
|
|
2744
|
+
ON DELETE CASCADE,
|
|
2745
|
+
CONSTRAINT merkle_store_module_database_prefix_unique
|
|
2746
|
+
UNIQUE (database_id, prefix)
|
|
2747
|
+
);
|
|
2748
|
+
|
|
2749
|
+
CREATE INDEX merkle_store_module_database_id_idx ON metaschema_modules_public.merkle_store_module (database_id);
|
|
2750
|
+
|
|
2751
|
+
CREATE TABLE metaschema_modules_public.graph_module (
|
|
2752
|
+
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
2753
|
+
database_id uuid NOT NULL,
|
|
2754
|
+
public_schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2755
|
+
private_schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2756
|
+
public_schema_name text,
|
|
2757
|
+
private_schema_name text,
|
|
2758
|
+
prefix text NOT NULL DEFAULT '',
|
|
2759
|
+
merkle_store_module_id uuid NOT NULL,
|
|
2760
|
+
graphs_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2761
|
+
executions_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2762
|
+
outputs_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2763
|
+
api_name text,
|
|
2764
|
+
private_api_name text,
|
|
2765
|
+
scope_field text NOT NULL DEFAULT 'scope_id',
|
|
2766
|
+
membership_type int DEFAULT NULL,
|
|
2767
|
+
entity_table_id uuid NULL,
|
|
2768
|
+
policies jsonb NULL,
|
|
2769
|
+
provisions jsonb NULL,
|
|
2770
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
2771
|
+
CONSTRAINT db_fkey
|
|
2772
|
+
FOREIGN KEY(database_id)
|
|
2773
|
+
REFERENCES metaschema_public.database (id)
|
|
2774
|
+
ON DELETE CASCADE,
|
|
2775
|
+
CONSTRAINT public_schema_fkey
|
|
2776
|
+
FOREIGN KEY(public_schema_id)
|
|
2777
|
+
REFERENCES metaschema_public.schema (id)
|
|
2778
|
+
ON DELETE CASCADE,
|
|
2779
|
+
CONSTRAINT private_schema_fkey
|
|
2780
|
+
FOREIGN KEY(private_schema_id)
|
|
2781
|
+
REFERENCES metaschema_public.schema (id)
|
|
2782
|
+
ON DELETE CASCADE,
|
|
2783
|
+
CONSTRAINT merkle_store_fkey
|
|
2784
|
+
FOREIGN KEY(merkle_store_module_id)
|
|
2785
|
+
REFERENCES metaschema_modules_public.merkle_store_module (id)
|
|
2786
|
+
ON DELETE CASCADE,
|
|
2787
|
+
CONSTRAINT graphs_table_fkey
|
|
2788
|
+
FOREIGN KEY(graphs_table_id)
|
|
2789
|
+
REFERENCES metaschema_public.table (id)
|
|
2790
|
+
ON DELETE CASCADE,
|
|
2791
|
+
CONSTRAINT executions_table_fkey
|
|
2792
|
+
FOREIGN KEY(executions_table_id)
|
|
2793
|
+
REFERENCES metaschema_public.table (id)
|
|
2794
|
+
ON DELETE CASCADE,
|
|
2795
|
+
CONSTRAINT outputs_table_fkey
|
|
2796
|
+
FOREIGN KEY(outputs_table_id)
|
|
2797
|
+
REFERENCES metaschema_public.table (id)
|
|
2798
|
+
ON DELETE CASCADE,
|
|
2799
|
+
CONSTRAINT graph_module_entity_table_fkey
|
|
2800
|
+
FOREIGN KEY(entity_table_id)
|
|
2801
|
+
REFERENCES metaschema_public.table (id)
|
|
2802
|
+
ON DELETE CASCADE,
|
|
2803
|
+
CONSTRAINT graph_module_database_merkle_unique
|
|
2804
|
+
UNIQUE (database_id, merkle_store_module_id)
|
|
2805
|
+
);
|
|
2806
|
+
|
|
2807
|
+
CREATE INDEX graph_module_database_id_idx ON metaschema_modules_public.graph_module (database_id);
|
|
2808
|
+
|
|
2809
|
+
CREATE TABLE metaschema_modules_public.namespace_module (
|
|
2810
|
+
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
2811
|
+
database_id uuid NOT NULL,
|
|
2812
|
+
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2813
|
+
private_schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2814
|
+
public_schema_name text,
|
|
2815
|
+
private_schema_name text,
|
|
2816
|
+
namespaces_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2817
|
+
namespace_events_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2818
|
+
namespaces_table_name text NOT NULL DEFAULT 'namespaces',
|
|
2819
|
+
namespace_events_table_name text NOT NULL DEFAULT 'namespace_events',
|
|
2820
|
+
api_name text,
|
|
2821
|
+
private_api_name text,
|
|
2822
|
+
membership_type int DEFAULT NULL,
|
|
2823
|
+
entity_table_id uuid NULL,
|
|
2824
|
+
policies jsonb NULL,
|
|
2825
|
+
provisions jsonb NULL,
|
|
2826
|
+
CONSTRAINT namespace_module_db_fkey
|
|
2827
|
+
FOREIGN KEY(database_id)
|
|
2828
|
+
REFERENCES metaschema_public.database (id)
|
|
2829
|
+
ON DELETE CASCADE,
|
|
2830
|
+
CONSTRAINT namespace_module_schema_fkey
|
|
2831
|
+
FOREIGN KEY(schema_id)
|
|
2832
|
+
REFERENCES metaschema_public.schema (id)
|
|
2833
|
+
ON DELETE CASCADE,
|
|
2834
|
+
CONSTRAINT namespace_module_private_schema_fkey
|
|
2835
|
+
FOREIGN KEY(private_schema_id)
|
|
2836
|
+
REFERENCES metaschema_public.schema (id)
|
|
2837
|
+
ON DELETE CASCADE,
|
|
2838
|
+
CONSTRAINT namespace_module_namespaces_table_fkey
|
|
2839
|
+
FOREIGN KEY(namespaces_table_id)
|
|
2840
|
+
REFERENCES metaschema_public.table (id)
|
|
2841
|
+
ON DELETE CASCADE,
|
|
2842
|
+
CONSTRAINT namespace_module_events_table_fkey
|
|
2843
|
+
FOREIGN KEY(namespace_events_table_id)
|
|
2844
|
+
REFERENCES metaschema_public.table (id)
|
|
2845
|
+
ON DELETE CASCADE,
|
|
2846
|
+
CONSTRAINT namespace_module_entity_table_fkey
|
|
2847
|
+
FOREIGN KEY(entity_table_id)
|
|
2848
|
+
REFERENCES metaschema_public.table (id)
|
|
2849
|
+
ON DELETE CASCADE
|
|
2850
|
+
);
|
|
2851
|
+
|
|
2852
|
+
CREATE INDEX namespace_module_database_id_idx ON metaschema_modules_public.namespace_module (database_id);
|
|
2853
|
+
|
|
2854
|
+
CREATE UNIQUE INDEX namespace_module_unique_scope ON metaschema_modules_public.namespace_module (database_id, (COALESCE(membership_type, -1)));
|
|
2855
|
+
|
|
2856
|
+
CREATE TABLE metaschema_modules_public.function_module (
|
|
2857
|
+
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
2858
|
+
database_id uuid NOT NULL,
|
|
2859
|
+
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2860
|
+
private_schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2861
|
+
public_schema_name text,
|
|
2862
|
+
private_schema_name text,
|
|
2863
|
+
definitions_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2864
|
+
invocations_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2865
|
+
execution_logs_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2866
|
+
definitions_table_name text NOT NULL DEFAULT 'function_definitions',
|
|
2867
|
+
invocations_table_name text NOT NULL DEFAULT 'function_invocations',
|
|
2868
|
+
execution_logs_table_name text NOT NULL DEFAULT 'function_execution_logs',
|
|
2869
|
+
api_name text,
|
|
2870
|
+
private_api_name text,
|
|
2871
|
+
membership_type int DEFAULT NULL,
|
|
2872
|
+
entity_table_id uuid NULL,
|
|
2873
|
+
policies jsonb NULL,
|
|
2874
|
+
provisions jsonb NULL,
|
|
2875
|
+
CONSTRAINT function_module_db_fkey
|
|
2876
|
+
FOREIGN KEY(database_id)
|
|
2877
|
+
REFERENCES metaschema_public.database (id)
|
|
2878
|
+
ON DELETE CASCADE,
|
|
2879
|
+
CONSTRAINT function_module_schema_fkey
|
|
2880
|
+
FOREIGN KEY(schema_id)
|
|
2881
|
+
REFERENCES metaschema_public.schema (id)
|
|
2882
|
+
ON DELETE CASCADE,
|
|
2883
|
+
CONSTRAINT function_module_private_schema_fkey
|
|
2884
|
+
FOREIGN KEY(private_schema_id)
|
|
2885
|
+
REFERENCES metaschema_public.schema (id)
|
|
2886
|
+
ON DELETE CASCADE,
|
|
2887
|
+
CONSTRAINT function_module_definitions_table_fkey
|
|
2888
|
+
FOREIGN KEY(definitions_table_id)
|
|
2889
|
+
REFERENCES metaschema_public.table (id)
|
|
2890
|
+
ON DELETE CASCADE,
|
|
2891
|
+
CONSTRAINT function_module_invocations_table_fkey
|
|
2892
|
+
FOREIGN KEY(invocations_table_id)
|
|
2893
|
+
REFERENCES metaschema_public.table (id)
|
|
2894
|
+
ON DELETE CASCADE,
|
|
2895
|
+
CONSTRAINT function_module_execution_logs_table_fkey
|
|
2896
|
+
FOREIGN KEY(execution_logs_table_id)
|
|
2897
|
+
REFERENCES metaschema_public.table (id)
|
|
2898
|
+
ON DELETE CASCADE,
|
|
2899
|
+
CONSTRAINT function_module_entity_table_fkey
|
|
2900
|
+
FOREIGN KEY(entity_table_id)
|
|
2901
|
+
REFERENCES metaschema_public.table (id)
|
|
2902
|
+
ON DELETE CASCADE
|
|
2903
|
+
);
|
|
2904
|
+
|
|
2905
|
+
CREATE INDEX function_module_database_id_idx ON metaschema_modules_public.function_module (database_id);
|
|
2906
|
+
|
|
2907
|
+
CREATE UNIQUE INDEX function_module_unique_scope ON metaschema_modules_public.function_module (database_id, (COALESCE(membership_type, -1)));
|