@pgpm/metaschema-modules 0.22.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/deploy/schemas/metaschema_modules_public/tables/billing_module/table.sql +5 -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/entity_type_provision/table.sql +44 -33
- package/deploy/schemas/metaschema_modules_public/tables/events_module/table.sql +85 -0
- package/deploy/schemas/metaschema_modules_public/tables/inference_log_module/table.sql +39 -0
- package/deploy/schemas/metaschema_modules_public/tables/limits_module/table.sql +11 -1
- 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_module/table.sql +12 -3
- package/deploy/schemas/metaschema_modules_public/tables/{secrets_module → user_state_module}/table.sql +4 -4
- package/package.json +4 -4
- package/pgpm.plan +6 -3
- 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/events_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/rate_limit_meters_module/table.sql +7 -0
- package/revert/schemas/metaschema_modules_public/tables/user_state_module/table.sql +7 -0
- package/sql/metaschema-modules--0.15.5.sql +325 -195
- 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/events_module/table.sql +7 -0
- package/verify/schemas/metaschema_modules_public/tables/inference_log_module/table.sql +21 -0
- package/verify/schemas/metaschema_modules_public/tables/rate_limit_meters_module/table.sql +7 -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)
|
|
331
344
|
ON DELETE CASCADE,
|
|
332
|
-
CONSTRAINT
|
|
333
|
-
FOREIGN KEY(
|
|
334
|
-
REFERENCES metaschema_public.
|
|
345
|
+
CONSTRAINT event_aggregates_table_fkey
|
|
346
|
+
FOREIGN KEY(event_aggregates_table_id)
|
|
347
|
+
REFERENCES metaschema_public.table (id)
|
|
348
|
+
ON DELETE CASCADE,
|
|
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
|
|
|
@@ -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,6 +1457,7 @@ 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
|
skip_default_policy_tables text[] NOT NULL DEFAULT '{}',
|
|
1425
1463
|
entity_table_id uuid 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(),
|
|
@@ -1494,6 +1534,7 @@ CREATE TABLE metaschema_modules_public.entity_type_provision (
|
|
|
1494
1534
|
has_levels boolean NOT NULL DEFAULT false,
|
|
1495
1535
|
has_storage boolean NOT NULL DEFAULT false,
|
|
1496
1536
|
has_invites boolean NOT NULL DEFAULT false,
|
|
1537
|
+
has_invite_achievements boolean NOT NULL DEFAULT false,
|
|
1497
1538
|
storage_config jsonb DEFAULT NULL,
|
|
1498
1539
|
skip_entity_policies boolean NOT NULL DEFAULT false,
|
|
1499
1540
|
table_provision jsonb DEFAULT NULL,
|
|
@@ -1563,7 +1604,7 @@ COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.has_profiles I
|
|
|
1563
1604
|
Profiles provide named permission roles (e.g. ''Editor'', ''Viewer'') with pre-configured permission bitmasks.
|
|
1564
1605
|
When true, creates profile tables and applies profiles security.';
|
|
1565
1606
|
|
|
1566
|
-
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.has_levels IS 'Whether to provision
|
|
1607
|
+
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.has_levels IS 'Whether to provision events_module for this type. Defaults to false.
|
|
1567
1608
|
Levels provide gamification/achievement tracking for members.
|
|
1568
1609
|
When true, creates level steps, achievements, and level tables with security.';
|
|
1569
1610
|
|
|
@@ -1580,6 +1621,14 @@ COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.has_invites IS
|
|
|
1580
1621
|
UNIQUE (database_id, membership_type) constraint on invites_module combined with
|
|
1581
1622
|
ON CONFLICT DO NOTHING in the fan-out makes repeated INSERTs safe.';
|
|
1582
1623
|
|
|
1624
|
+
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
|
|
1625
|
+
achievements. Defaults to false. Requires has_invites=true AND has_levels=true.
|
|
1626
|
+
When true, the trigger calls event_tracker() on the claimed_invites table with
|
|
1627
|
+
event_name=''invite_claimed'', actor_field=''sender_id'', events=[''INSERT''],
|
|
1628
|
+
crediting the SENDER (inviter) when someone claims their invite code.
|
|
1629
|
+
Developers can then define achievements in the blueprint achievements[] section
|
|
1630
|
+
that reference the ''invite_claimed'' event (e.g., "Invite 5 friends" = count: 5).';
|
|
1631
|
+
|
|
1583
1632
|
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
1633
|
Use this only when you want the entity table provisioned with zero policies (e.g. because you
|
|
1585
1634
|
plan to insert secure_table_provision rows yourself later). In most cases, prefer leaving this
|
|
@@ -1633,36 +1682,34 @@ COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.out_entity_tab
|
|
|
1633
1682
|
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
1683
|
Populated by the trigger. Useful for verifying which modules were provisioned.';
|
|
1635
1684
|
|
|
1636
|
-
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.storage_config IS 'Optional
|
|
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
|
-
Example:
|
|
1665
|
-
storage_config := ''{"buckets": [{"name": "documents", "is_public": false, "allowed_mime_types": ["application/pdf"]}], "provisions": {"files": {"nodes": [{"$type": "SearchBm25", "data": {"source_fields": ["description"]}}]}}}''::jsonb';
|
|
1685
|
+
COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.storage_config IS 'Optional JSON array of storage module definitions. Each element provisions a separate
|
|
1686
|
+
storage module with its own tables ({prefix}_{storage_key}_buckets/files), RLS policies,
|
|
1687
|
+
and feature flags. Only used when has_storage = true; ignored otherwise.
|
|
1688
|
+
NULL = provision a single default storage module with all defaults.
|
|
1689
|
+
Each array element recognizes (all optional):
|
|
1690
|
+
- storage_key (text) module discriminator, max 16 chars, lowercase snake_case.
|
|
1691
|
+
Defaults to ''default'' (omitted from table names).
|
|
1692
|
+
Non-default keys become infixes: {prefix}_{key}_buckets.
|
|
1693
|
+
- upload_url_expiry_seconds (integer) presigned PUT URL expiry override
|
|
1694
|
+
- download_url_expiry_seconds (integer) presigned GET URL expiry override
|
|
1695
|
+
- default_max_file_size (bigint) global max file size in bytes for this module
|
|
1696
|
+
- allowed_origins (text[]) default CORS origins for all buckets in this module
|
|
1697
|
+
- restrict_reads (boolean) require read_files permission for SELECT on files
|
|
1698
|
+
- has_path_shares (boolean) enable virtual filesystem + path share policies
|
|
1699
|
+
- has_versioning (boolean) enable file version chains
|
|
1700
|
+
- has_content_hash (boolean) enable content hash for dedup
|
|
1701
|
+
- has_custom_keys (boolean) allow client-provided S3 keys
|
|
1702
|
+
- has_audit_log (boolean) enable file events audit table
|
|
1703
|
+
- has_confirm_upload (boolean) enable HeadObject confirmation flow
|
|
1704
|
+
- confirm_upload_delay (interval) delay before first confirmation attempt
|
|
1705
|
+
- buckets (jsonb[]) array of initial bucket definitions to seed.
|
|
1706
|
+
Each bucket: { name (required), description, is_public, allowed_mime_types, max_file_size, allowed_origins }
|
|
1707
|
+
- provisions (jsonb object) per-table customization keyed by "files" or "buckets".
|
|
1708
|
+
Each value: { nodes, fields, grants, use_rls, policies }.
|
|
1709
|
+
Example (single module, backward compat):
|
|
1710
|
+
storage_config := ''[{"buckets": [{"name": "documents"}]}]''::jsonb
|
|
1711
|
+
Example (multi-module):
|
|
1712
|
+
storage_config := ''[{"has_path_shares": true, "buckets": [{"name": "documents"}]}, {"storage_key": "fn", "has_custom_keys": true, "buckets": [{"name": "functions"}]}]''::jsonb';
|
|
1666
1713
|
|
|
1667
1714
|
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 has_storage=true.';
|
|
1668
1715
|
|
|
@@ -1694,15 +1741,15 @@ CREATE TABLE metaschema_modules_public.rate_limits_module (
|
|
|
1694
1741
|
ON DELETE CASCADE,
|
|
1695
1742
|
CONSTRAINT rate_limit_settings_table_fkey
|
|
1696
1743
|
FOREIGN KEY(rate_limit_settings_table_id)
|
|
1697
|
-
REFERENCES metaschema_public.
|
|
1744
|
+
REFERENCES metaschema_public.table (id)
|
|
1698
1745
|
ON DELETE CASCADE,
|
|
1699
1746
|
CONSTRAINT ip_rate_limits_table_fkey
|
|
1700
1747
|
FOREIGN KEY(ip_rate_limits_table_id)
|
|
1701
|
-
REFERENCES metaschema_public.
|
|
1748
|
+
REFERENCES metaschema_public.table (id)
|
|
1702
1749
|
ON DELETE CASCADE,
|
|
1703
1750
|
CONSTRAINT rate_limits_table_fkey
|
|
1704
1751
|
FOREIGN KEY(rate_limits_table_id)
|
|
1705
|
-
REFERENCES metaschema_public.
|
|
1752
|
+
REFERENCES metaschema_public.table (id)
|
|
1706
1753
|
ON DELETE CASCADE,
|
|
1707
1754
|
CONSTRAINT rate_limits_module_database_id_uniq
|
|
1708
1755
|
UNIQUE (database_id)
|
|
@@ -1734,11 +1781,11 @@ CREATE TABLE metaschema_modules_public.devices_module (
|
|
|
1734
1781
|
ON DELETE CASCADE,
|
|
1735
1782
|
CONSTRAINT user_devices_table_fkey
|
|
1736
1783
|
FOREIGN KEY(user_devices_table_id)
|
|
1737
|
-
REFERENCES metaschema_public.
|
|
1784
|
+
REFERENCES metaschema_public.table (id)
|
|
1738
1785
|
ON DELETE CASCADE,
|
|
1739
1786
|
CONSTRAINT device_settings_table_fkey
|
|
1740
1787
|
FOREIGN KEY(device_settings_table_id)
|
|
1741
|
-
REFERENCES metaschema_public.
|
|
1788
|
+
REFERENCES metaschema_public.table (id)
|
|
1742
1789
|
ON DELETE CASCADE,
|
|
1743
1790
|
CONSTRAINT devices_module_database_id_uniq
|
|
1744
1791
|
UNIQUE (database_id)
|
|
@@ -1767,11 +1814,11 @@ CREATE TABLE metaschema_modules_public.session_secrets_module (
|
|
|
1767
1814
|
ON DELETE CASCADE,
|
|
1768
1815
|
CONSTRAINT table_fkey
|
|
1769
1816
|
FOREIGN KEY(table_id)
|
|
1770
|
-
REFERENCES metaschema_public.
|
|
1817
|
+
REFERENCES metaschema_public.table (id)
|
|
1771
1818
|
ON DELETE CASCADE,
|
|
1772
1819
|
CONSTRAINT sessions_table_fkey
|
|
1773
1820
|
FOREIGN KEY(sessions_table_id)
|
|
1774
|
-
REFERENCES metaschema_public.
|
|
1821
|
+
REFERENCES metaschema_public.table (id)
|
|
1775
1822
|
ON DELETE CASCADE
|
|
1776
1823
|
);
|
|
1777
1824
|
|
|
@@ -1801,11 +1848,11 @@ CREATE TABLE metaschema_modules_public.webauthn_credentials_module (
|
|
|
1801
1848
|
ON DELETE CASCADE,
|
|
1802
1849
|
CONSTRAINT table_fkey
|
|
1803
1850
|
FOREIGN KEY(table_id)
|
|
1804
|
-
REFERENCES metaschema_public.
|
|
1851
|
+
REFERENCES metaschema_public.table (id)
|
|
1805
1852
|
ON DELETE CASCADE,
|
|
1806
1853
|
CONSTRAINT owner_table_fkey
|
|
1807
1854
|
FOREIGN KEY(owner_table_id)
|
|
1808
|
-
REFERENCES metaschema_public.
|
|
1855
|
+
REFERENCES metaschema_public.table (id)
|
|
1809
1856
|
ON DELETE CASCADE,
|
|
1810
1857
|
CONSTRAINT schema_fkey
|
|
1811
1858
|
FOREIGN KEY(schema_id)
|
|
@@ -1850,27 +1897,27 @@ CREATE TABLE metaschema_modules_public.webauthn_auth_module (
|
|
|
1850
1897
|
ON DELETE CASCADE,
|
|
1851
1898
|
CONSTRAINT users_table_fkey
|
|
1852
1899
|
FOREIGN KEY(users_table_id)
|
|
1853
|
-
REFERENCES metaschema_public.
|
|
1900
|
+
REFERENCES metaschema_public.table (id)
|
|
1854
1901
|
ON DELETE CASCADE,
|
|
1855
1902
|
CONSTRAINT credentials_table_fkey
|
|
1856
1903
|
FOREIGN KEY(credentials_table_id)
|
|
1857
|
-
REFERENCES metaschema_public.
|
|
1904
|
+
REFERENCES metaschema_public.table (id)
|
|
1858
1905
|
ON DELETE CASCADE,
|
|
1859
1906
|
CONSTRAINT sessions_table_fkey
|
|
1860
1907
|
FOREIGN KEY(sessions_table_id)
|
|
1861
|
-
REFERENCES metaschema_public.
|
|
1908
|
+
REFERENCES metaschema_public.table (id)
|
|
1862
1909
|
ON DELETE CASCADE,
|
|
1863
1910
|
CONSTRAINT session_credentials_table_fkey
|
|
1864
1911
|
FOREIGN KEY(session_credentials_table_id)
|
|
1865
|
-
REFERENCES metaschema_public.
|
|
1912
|
+
REFERENCES metaschema_public.table (id)
|
|
1866
1913
|
ON DELETE CASCADE,
|
|
1867
1914
|
CONSTRAINT session_secrets_table_fkey
|
|
1868
1915
|
FOREIGN KEY(session_secrets_table_id)
|
|
1869
|
-
REFERENCES metaschema_public.
|
|
1916
|
+
REFERENCES metaschema_public.table (id)
|
|
1870
1917
|
ON DELETE CASCADE,
|
|
1871
1918
|
CONSTRAINT auth_settings_table_fkey
|
|
1872
1919
|
FOREIGN KEY(auth_settings_table_id)
|
|
1873
|
-
REFERENCES metaschema_public.
|
|
1920
|
+
REFERENCES metaschema_public.table (id)
|
|
1874
1921
|
ON DELETE CASCADE
|
|
1875
1922
|
);
|
|
1876
1923
|
|
|
@@ -1889,7 +1936,7 @@ CREATE TABLE metaschema_modules_public.identity_providers_module (
|
|
|
1889
1936
|
ON DELETE CASCADE,
|
|
1890
1937
|
CONSTRAINT table_fkey
|
|
1891
1938
|
FOREIGN KEY(table_id)
|
|
1892
|
-
REFERENCES metaschema_public.
|
|
1939
|
+
REFERENCES metaschema_public.table (id)
|
|
1893
1940
|
ON DELETE CASCADE,
|
|
1894
1941
|
CONSTRAINT schema_fkey
|
|
1895
1942
|
FOREIGN KEY(schema_id)
|
|
@@ -1937,35 +1984,35 @@ CREATE TABLE metaschema_modules_public.notifications_module (
|
|
|
1937
1984
|
ON DELETE CASCADE,
|
|
1938
1985
|
CONSTRAINT notifications_table_fkey
|
|
1939
1986
|
FOREIGN KEY(notifications_table_id)
|
|
1940
|
-
REFERENCES metaschema_public.
|
|
1987
|
+
REFERENCES metaschema_public.table (id)
|
|
1941
1988
|
ON DELETE CASCADE,
|
|
1942
1989
|
CONSTRAINT read_state_table_fkey
|
|
1943
1990
|
FOREIGN KEY(read_state_table_id)
|
|
1944
|
-
REFERENCES metaschema_public.
|
|
1991
|
+
REFERENCES metaschema_public.table (id)
|
|
1945
1992
|
ON DELETE CASCADE,
|
|
1946
1993
|
CONSTRAINT preferences_table_fkey
|
|
1947
1994
|
FOREIGN KEY(preferences_table_id)
|
|
1948
|
-
REFERENCES metaschema_public.
|
|
1995
|
+
REFERENCES metaschema_public.table (id)
|
|
1949
1996
|
ON DELETE SET NULL,
|
|
1950
1997
|
CONSTRAINT channels_table_fkey
|
|
1951
1998
|
FOREIGN KEY(channels_table_id)
|
|
1952
|
-
REFERENCES metaschema_public.
|
|
1999
|
+
REFERENCES metaschema_public.table (id)
|
|
1953
2000
|
ON DELETE SET NULL,
|
|
1954
2001
|
CONSTRAINT delivery_log_table_fkey
|
|
1955
2002
|
FOREIGN KEY(delivery_log_table_id)
|
|
1956
|
-
REFERENCES metaschema_public.
|
|
2003
|
+
REFERENCES metaschema_public.table (id)
|
|
1957
2004
|
ON DELETE SET NULL,
|
|
1958
2005
|
CONSTRAINT owner_table_fkey
|
|
1959
2006
|
FOREIGN KEY(owner_table_id)
|
|
1960
|
-
REFERENCES metaschema_public.
|
|
2007
|
+
REFERENCES metaschema_public.table (id)
|
|
1961
2008
|
ON DELETE CASCADE,
|
|
1962
2009
|
CONSTRAINT user_settings_table_fkey
|
|
1963
2010
|
FOREIGN KEY(user_settings_table_id)
|
|
1964
|
-
REFERENCES metaschema_public.
|
|
2011
|
+
REFERENCES metaschema_public.table (id)
|
|
1965
2012
|
ON DELETE SET NULL,
|
|
1966
2013
|
CONSTRAINT organization_settings_table_fkey
|
|
1967
2014
|
FOREIGN KEY(organization_settings_table_id)
|
|
1968
|
-
REFERENCES metaschema_public.
|
|
2015
|
+
REFERENCES metaschema_public.table (id)
|
|
1969
2016
|
ON DELETE SET NULL,
|
|
1970
2017
|
CONSTRAINT schema_fkey
|
|
1971
2018
|
FOREIGN KEY(schema_id)
|
|
@@ -2036,19 +2083,19 @@ CREATE TABLE metaschema_modules_public.plans_module (
|
|
|
2036
2083
|
ON DELETE CASCADE,
|
|
2037
2084
|
CONSTRAINT plans_table_fkey
|
|
2038
2085
|
FOREIGN KEY(plans_table_id)
|
|
2039
|
-
REFERENCES metaschema_public.
|
|
2086
|
+
REFERENCES metaschema_public.table (id)
|
|
2040
2087
|
ON DELETE CASCADE,
|
|
2041
2088
|
CONSTRAINT plan_limits_table_fkey
|
|
2042
2089
|
FOREIGN KEY(plan_limits_table_id)
|
|
2043
|
-
REFERENCES metaschema_public.
|
|
2090
|
+
REFERENCES metaschema_public.table (id)
|
|
2044
2091
|
ON DELETE CASCADE,
|
|
2045
2092
|
CONSTRAINT plan_pricing_table_fkey
|
|
2046
2093
|
FOREIGN KEY(plan_pricing_table_id)
|
|
2047
|
-
REFERENCES metaschema_public.
|
|
2094
|
+
REFERENCES metaschema_public.table (id)
|
|
2048
2095
|
ON DELETE CASCADE,
|
|
2049
2096
|
CONSTRAINT plan_overrides_table_fkey
|
|
2050
2097
|
FOREIGN KEY(plan_overrides_table_id)
|
|
2051
|
-
REFERENCES metaschema_public.
|
|
2098
|
+
REFERENCES metaschema_public.table (id)
|
|
2052
2099
|
ON DELETE CASCADE,
|
|
2053
2100
|
CONSTRAINT plans_module_database_id_unique
|
|
2054
2101
|
UNIQUE (database_id)
|
|
@@ -2069,6 +2116,8 @@ CREATE TABLE metaschema_modules_public.billing_module (
|
|
|
2069
2116
|
ledger_table_name text NOT NULL DEFAULT '',
|
|
2070
2117
|
balances_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2071
2118
|
balances_table_name text NOT NULL DEFAULT '',
|
|
2119
|
+
meter_credits_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2120
|
+
meter_credits_table_name text NOT NULL DEFAULT '',
|
|
2072
2121
|
record_usage_function text NOT NULL DEFAULT '',
|
|
2073
2122
|
prefix text NULL,
|
|
2074
2123
|
CONSTRAINT db_fkey
|
|
@@ -2085,19 +2134,23 @@ CREATE TABLE metaschema_modules_public.billing_module (
|
|
|
2085
2134
|
ON DELETE CASCADE,
|
|
2086
2135
|
CONSTRAINT meters_table_fkey
|
|
2087
2136
|
FOREIGN KEY(meters_table_id)
|
|
2088
|
-
REFERENCES metaschema_public.
|
|
2137
|
+
REFERENCES metaschema_public.table (id)
|
|
2089
2138
|
ON DELETE CASCADE,
|
|
2090
2139
|
CONSTRAINT plan_subscriptions_table_fkey
|
|
2091
2140
|
FOREIGN KEY(plan_subscriptions_table_id)
|
|
2092
|
-
REFERENCES metaschema_public.
|
|
2141
|
+
REFERENCES metaschema_public.table (id)
|
|
2093
2142
|
ON DELETE CASCADE,
|
|
2094
2143
|
CONSTRAINT ledger_table_fkey
|
|
2095
2144
|
FOREIGN KEY(ledger_table_id)
|
|
2096
|
-
REFERENCES metaschema_public.
|
|
2145
|
+
REFERENCES metaschema_public.table (id)
|
|
2097
2146
|
ON DELETE CASCADE,
|
|
2098
2147
|
CONSTRAINT balances_table_fkey
|
|
2099
2148
|
FOREIGN KEY(balances_table_id)
|
|
2100
|
-
REFERENCES metaschema_public.
|
|
2149
|
+
REFERENCES metaschema_public.table (id)
|
|
2150
|
+
ON DELETE CASCADE,
|
|
2151
|
+
CONSTRAINT meter_credits_table_fkey
|
|
2152
|
+
FOREIGN KEY(meter_credits_table_id)
|
|
2153
|
+
REFERENCES metaschema_public.table (id)
|
|
2101
2154
|
ON DELETE CASCADE,
|
|
2102
2155
|
CONSTRAINT billing_module_database_id_unique
|
|
2103
2156
|
UNIQUE (database_id)
|
|
@@ -2140,35 +2193,35 @@ CREATE TABLE metaschema_modules_public.billing_provider_module (
|
|
|
2140
2193
|
ON DELETE CASCADE,
|
|
2141
2194
|
CONSTRAINT billing_customers_table_fkey
|
|
2142
2195
|
FOREIGN KEY(billing_customers_table_id)
|
|
2143
|
-
REFERENCES metaschema_public.
|
|
2196
|
+
REFERENCES metaschema_public.table (id)
|
|
2144
2197
|
ON DELETE CASCADE,
|
|
2145
2198
|
CONSTRAINT billing_products_table_fkey
|
|
2146
2199
|
FOREIGN KEY(billing_products_table_id)
|
|
2147
|
-
REFERENCES metaschema_public.
|
|
2200
|
+
REFERENCES metaschema_public.table (id)
|
|
2148
2201
|
ON DELETE CASCADE,
|
|
2149
2202
|
CONSTRAINT billing_prices_table_fkey
|
|
2150
2203
|
FOREIGN KEY(billing_prices_table_id)
|
|
2151
|
-
REFERENCES metaschema_public.
|
|
2204
|
+
REFERENCES metaschema_public.table (id)
|
|
2152
2205
|
ON DELETE CASCADE,
|
|
2153
2206
|
CONSTRAINT billing_subscriptions_table_fkey
|
|
2154
2207
|
FOREIGN KEY(billing_subscriptions_table_id)
|
|
2155
|
-
REFERENCES metaschema_public.
|
|
2208
|
+
REFERENCES metaschema_public.table (id)
|
|
2156
2209
|
ON DELETE CASCADE,
|
|
2157
2210
|
CONSTRAINT billing_webhook_events_table_fkey
|
|
2158
2211
|
FOREIGN KEY(billing_webhook_events_table_id)
|
|
2159
|
-
REFERENCES metaschema_public.
|
|
2212
|
+
REFERENCES metaschema_public.table (id)
|
|
2160
2213
|
ON DELETE CASCADE,
|
|
2161
2214
|
CONSTRAINT products_table_fkey
|
|
2162
2215
|
FOREIGN KEY(products_table_id)
|
|
2163
|
-
REFERENCES metaschema_public.
|
|
2216
|
+
REFERENCES metaschema_public.table (id)
|
|
2164
2217
|
ON DELETE SET NULL,
|
|
2165
2218
|
CONSTRAINT prices_table_fkey
|
|
2166
2219
|
FOREIGN KEY(prices_table_id)
|
|
2167
|
-
REFERENCES metaschema_public.
|
|
2220
|
+
REFERENCES metaschema_public.table (id)
|
|
2168
2221
|
ON DELETE SET NULL,
|
|
2169
2222
|
CONSTRAINT subscriptions_table_fkey
|
|
2170
2223
|
FOREIGN KEY(subscriptions_table_id)
|
|
2171
|
-
REFERENCES metaschema_public.
|
|
2224
|
+
REFERENCES metaschema_public.table (id)
|
|
2172
2225
|
ON DELETE SET NULL,
|
|
2173
2226
|
CONSTRAINT billing_provider_module_database_id_unique
|
|
2174
2227
|
UNIQUE (database_id)
|
|
@@ -2186,8 +2239,8 @@ CREATE TABLE metaschema_modules_public.realtime_module (
|
|
|
2186
2239
|
listener_node_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2187
2240
|
source_registry_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2188
2241
|
retention_hours int NOT NULL DEFAULT 168,
|
|
2189
|
-
|
|
2190
|
-
|
|
2242
|
+
premake int NOT NULL DEFAULT 7,
|
|
2243
|
+
"interval" text NOT NULL DEFAULT '1 day',
|
|
2191
2244
|
notify_channel text NULL,
|
|
2192
2245
|
CONSTRAINT db_fkey
|
|
2193
2246
|
FOREIGN KEY(database_id)
|
|
@@ -2207,15 +2260,15 @@ CREATE TABLE metaschema_modules_public.realtime_module (
|
|
|
2207
2260
|
ON DELETE CASCADE,
|
|
2208
2261
|
CONSTRAINT change_log_table_fkey
|
|
2209
2262
|
FOREIGN KEY(change_log_table_id)
|
|
2210
|
-
REFERENCES metaschema_public.
|
|
2263
|
+
REFERENCES metaschema_public.table (id)
|
|
2211
2264
|
ON DELETE CASCADE,
|
|
2212
2265
|
CONSTRAINT listener_node_table_fkey
|
|
2213
2266
|
FOREIGN KEY(listener_node_table_id)
|
|
2214
|
-
REFERENCES metaschema_public.
|
|
2267
|
+
REFERENCES metaschema_public.table (id)
|
|
2215
2268
|
ON DELETE CASCADE,
|
|
2216
2269
|
CONSTRAINT source_registry_table_fkey
|
|
2217
2270
|
FOREIGN KEY(source_registry_table_id)
|
|
2218
|
-
REFERENCES metaschema_public.
|
|
2271
|
+
REFERENCES metaschema_public.table (id)
|
|
2219
2272
|
ON DELETE CASCADE
|
|
2220
2273
|
);
|
|
2221
2274
|
|
|
@@ -2233,4 +2286,81 @@ CREATE INDEX realtime_module_change_log_table_id_idx ON metaschema_modules_publi
|
|
|
2233
2286
|
|
|
2234
2287
|
CREATE INDEX realtime_module_listener_node_table_id_idx ON metaschema_modules_public.realtime_module (listener_node_table_id);
|
|
2235
2288
|
|
|
2236
|
-
CREATE INDEX realtime_module_source_registry_table_id_idx ON metaschema_modules_public.realtime_module (source_registry_table_id);
|
|
2289
|
+
CREATE INDEX realtime_module_source_registry_table_id_idx ON metaschema_modules_public.realtime_module (source_registry_table_id);
|
|
2290
|
+
|
|
2291
|
+
CREATE TABLE metaschema_modules_public.rate_limit_meters_module (
|
|
2292
|
+
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
2293
|
+
database_id uuid NOT NULL,
|
|
2294
|
+
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2295
|
+
private_schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2296
|
+
rate_limit_state_table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2297
|
+
rate_limit_state_table_name text NOT NULL DEFAULT '',
|
|
2298
|
+
rate_limit_overrides_table_id uuid NULL,
|
|
2299
|
+
rate_limit_overrides_table_name text NOT NULL DEFAULT '',
|
|
2300
|
+
rate_window_limits_table_id uuid NULL,
|
|
2301
|
+
rate_window_limits_table_name text NOT NULL DEFAULT '',
|
|
2302
|
+
check_rate_limit_function text NOT NULL DEFAULT '',
|
|
2303
|
+
prefix text NULL,
|
|
2304
|
+
CONSTRAINT db_fkey
|
|
2305
|
+
FOREIGN KEY(database_id)
|
|
2306
|
+
REFERENCES metaschema_public.database (id)
|
|
2307
|
+
ON DELETE CASCADE,
|
|
2308
|
+
CONSTRAINT schema_fkey
|
|
2309
|
+
FOREIGN KEY(schema_id)
|
|
2310
|
+
REFERENCES metaschema_public.schema (id)
|
|
2311
|
+
ON DELETE CASCADE,
|
|
2312
|
+
CONSTRAINT private_schema_fkey
|
|
2313
|
+
FOREIGN KEY(private_schema_id)
|
|
2314
|
+
REFERENCES metaschema_public.schema (id)
|
|
2315
|
+
ON DELETE CASCADE,
|
|
2316
|
+
CONSTRAINT rate_limit_state_table_fkey
|
|
2317
|
+
FOREIGN KEY(rate_limit_state_table_id)
|
|
2318
|
+
REFERENCES metaschema_public.table (id)
|
|
2319
|
+
ON DELETE CASCADE,
|
|
2320
|
+
CONSTRAINT rate_limit_overrides_table_fkey
|
|
2321
|
+
FOREIGN KEY(rate_limit_overrides_table_id)
|
|
2322
|
+
REFERENCES metaschema_public.table (id)
|
|
2323
|
+
ON DELETE CASCADE,
|
|
2324
|
+
CONSTRAINT rate_window_limits_table_fkey
|
|
2325
|
+
FOREIGN KEY(rate_window_limits_table_id)
|
|
2326
|
+
REFERENCES metaschema_public.table (id)
|
|
2327
|
+
ON DELETE CASCADE,
|
|
2328
|
+
CONSTRAINT rate_limit_meters_module_database_id_unique
|
|
2329
|
+
UNIQUE (database_id)
|
|
2330
|
+
);
|
|
2331
|
+
|
|
2332
|
+
CREATE INDEX rate_limit_meters_module_database_id_idx ON metaschema_modules_public.rate_limit_meters_module (database_id);
|
|
2333
|
+
|
|
2334
|
+
COMMENT ON CONSTRAINT rate_limit_state_table_fkey ON metaschema_modules_public.rate_limit_meters_module IS '@fieldName rateLimitStateTableByRateLimitStateTableId';
|
|
2335
|
+
|
|
2336
|
+
COMMENT ON CONSTRAINT rate_limit_overrides_table_fkey ON metaschema_modules_public.rate_limit_meters_module IS '@fieldName rateLimitOverridesTableByRateLimitOverridesTableId';
|
|
2337
|
+
|
|
2338
|
+
COMMENT ON CONSTRAINT rate_window_limits_table_fkey ON metaschema_modules_public.rate_limit_meters_module IS '@fieldName rateWindowLimitsTableByRateWindowLimitsTableId';
|
|
2339
|
+
|
|
2340
|
+
CREATE TABLE metaschema_modules_public.config_secrets_org_module (
|
|
2341
|
+
id uuid PRIMARY KEY DEFAULT uuidv7(),
|
|
2342
|
+
database_id uuid NOT NULL,
|
|
2343
|
+
schema_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2344
|
+
table_id uuid NOT NULL DEFAULT uuid_nil(),
|
|
2345
|
+
table_name text NOT NULL DEFAULT 'org_secrets',
|
|
2346
|
+
CONSTRAINT db_fkey
|
|
2347
|
+
FOREIGN KEY(database_id)
|
|
2348
|
+
REFERENCES metaschema_public.database (id)
|
|
2349
|
+
ON DELETE CASCADE,
|
|
2350
|
+
CONSTRAINT schema_fkey
|
|
2351
|
+
FOREIGN KEY(schema_id)
|
|
2352
|
+
REFERENCES metaschema_public.schema (id)
|
|
2353
|
+
ON DELETE CASCADE,
|
|
2354
|
+
CONSTRAINT table_fkey
|
|
2355
|
+
FOREIGN KEY(table_id)
|
|
2356
|
+
REFERENCES metaschema_public.table (id)
|
|
2357
|
+
ON DELETE CASCADE
|
|
2358
|
+
);
|
|
2359
|
+
|
|
2360
|
+
CREATE INDEX config_secrets_org_module_database_id_idx ON metaschema_modules_public.config_secrets_org_module (database_id);
|
|
2361
|
+
|
|
2362
|
+
CREATE INDEX config_secrets_org_module_schema_id_idx ON metaschema_modules_public.config_secrets_org_module (schema_id);
|
|
2363
|
+
|
|
2364
|
+
CREATE INDEX config_secrets_org_module_table_id_idx ON metaschema_modules_public.config_secrets_org_module (table_id);
|
|
2365
|
+
|
|
2366
|
+
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.';
|