@pgpm/metaschema-modules 0.26.1 → 0.26.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,11 +37,11 @@ CREATE TABLE metaschema_modules_public.connected_accounts_module (
37
37
  ON DELETE CASCADE,
38
38
  CONSTRAINT table_fkey
39
39
  FOREIGN KEY(table_id)
40
- REFERENCES metaschema_public.table (id)
40
+ REFERENCES metaschema_public."table" (id)
41
41
  ON DELETE CASCADE,
42
42
  CONSTRAINT owner_table_fkey
43
43
  FOREIGN KEY(owner_table_id)
44
- REFERENCES metaschema_public.table (id)
44
+ REFERENCES metaschema_public."table" (id)
45
45
  ON DELETE CASCADE,
46
46
  CONSTRAINT schema_fkey
47
47
  FOREIGN KEY(schema_id)
@@ -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.table (id)
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.table (id)
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.table (id)
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.table (id)
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.table (id)
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.table (id)
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.table (id)
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.table (id)
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.table (id)
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.table (id)
200
+ REFERENCES metaschema_public."table" (id)
201
201
  ON DELETE CASCADE,
202
202
  CONSTRAINT schema_fkey
203
203
  FOREIGN KEY(schema_id)
@@ -217,6 +217,7 @@ CREATE TABLE metaschema_modules_public.config_secrets_user_module (
217
217
  schema_id uuid NOT NULL DEFAULT uuid_nil(),
218
218
  table_id uuid NOT NULL DEFAULT uuid_nil(),
219
219
  table_name text NOT NULL DEFAULT 'user_secrets',
220
+ config_definitions_table_id uuid NOT NULL DEFAULT uuid_nil(),
220
221
  CONSTRAINT db_fkey
221
222
  FOREIGN KEY(database_id)
222
223
  REFERENCES metaschema_public.database (id)
@@ -227,7 +228,11 @@ CREATE TABLE metaschema_modules_public.config_secrets_user_module (
227
228
  ON DELETE CASCADE,
228
229
  CONSTRAINT table_fkey
229
230
  FOREIGN KEY(table_id)
230
- REFERENCES metaschema_public.table (id)
231
+ REFERENCES metaschema_public."table" (id)
232
+ ON DELETE CASCADE,
233
+ CONSTRAINT config_defs_table_fkey
234
+ FOREIGN KEY(config_definitions_table_id)
235
+ REFERENCES metaschema_public."table" (id)
231
236
  ON DELETE CASCADE
232
237
  );
233
238
 
@@ -254,23 +259,23 @@ CREATE TABLE metaschema_modules_public.invites_module (
254
259
  ON DELETE CASCADE,
255
260
  CONSTRAINT invites_table_fkey
256
261
  FOREIGN KEY(invites_table_id)
257
- REFERENCES metaschema_public.table (id)
262
+ REFERENCES metaschema_public."table" (id)
258
263
  ON DELETE CASCADE,
259
264
  CONSTRAINT emails_table_fkey
260
265
  FOREIGN KEY(emails_table_id)
261
- REFERENCES metaschema_public.table (id)
266
+ REFERENCES metaschema_public."table" (id)
262
267
  ON DELETE CASCADE,
263
268
  CONSTRAINT users_table_fkey
264
269
  FOREIGN KEY(users_table_id)
265
- REFERENCES metaschema_public.table (id)
270
+ REFERENCES metaschema_public."table" (id)
266
271
  ON DELETE CASCADE,
267
272
  CONSTRAINT entity_table_fkey
268
273
  FOREIGN KEY(entity_table_id)
269
- REFERENCES metaschema_public.table (id)
274
+ REFERENCES metaschema_public."table" (id)
270
275
  ON DELETE CASCADE,
271
276
  CONSTRAINT claimed_invites_table_fkey
272
277
  FOREIGN KEY(claimed_invites_table_id)
273
- REFERENCES metaschema_public.table (id)
278
+ REFERENCES metaschema_public."table" (id)
274
279
  ON DELETE CASCADE,
275
280
  CONSTRAINT schema_fkey
276
281
  FOREIGN KEY(schema_id)
@@ -319,7 +324,7 @@ CREATE TABLE metaschema_modules_public.events_module (
319
324
  tg_check_achievements text NOT NULL DEFAULT '',
320
325
  grant_achievement text NOT NULL DEFAULT '',
321
326
  tg_achievement_reward text NOT NULL DEFAULT '',
322
- "interval" text NOT NULL DEFAULT '1 month',
327
+ interval text NOT NULL DEFAULT '1 month',
323
328
  retention text DEFAULT '12 months',
324
329
  premake int NOT NULL DEFAULT 2,
325
330
  prefix text NULL,
@@ -340,39 +345,39 @@ CREATE TABLE metaschema_modules_public.events_module (
340
345
  ON DELETE CASCADE,
341
346
  CONSTRAINT events_table_fkey
342
347
  FOREIGN KEY(events_table_id)
343
- REFERENCES metaschema_public.table (id)
348
+ REFERENCES metaschema_public."table" (id)
344
349
  ON DELETE CASCADE,
345
350
  CONSTRAINT event_aggregates_table_fkey
346
351
  FOREIGN KEY(event_aggregates_table_id)
347
- REFERENCES metaschema_public.table (id)
352
+ REFERENCES metaschema_public."table" (id)
348
353
  ON DELETE CASCADE,
349
354
  CONSTRAINT event_types_table_fkey
350
355
  FOREIGN KEY(event_types_table_id)
351
- REFERENCES metaschema_public.table (id)
356
+ REFERENCES metaschema_public."table" (id)
352
357
  ON DELETE CASCADE,
353
358
  CONSTRAINT levels_table_fkey
354
359
  FOREIGN KEY(levels_table_id)
355
- REFERENCES metaschema_public.table (id)
360
+ REFERENCES metaschema_public."table" (id)
356
361
  ON DELETE CASCADE,
357
362
  CONSTRAINT level_requirements_table_fkey
358
363
  FOREIGN KEY(level_requirements_table_id)
359
- REFERENCES metaschema_public.table (id)
364
+ REFERENCES metaschema_public."table" (id)
360
365
  ON DELETE CASCADE,
361
366
  CONSTRAINT level_grants_table_fkey
362
367
  FOREIGN KEY(level_grants_table_id)
363
- REFERENCES metaschema_public.table (id)
368
+ REFERENCES metaschema_public."table" (id)
364
369
  ON DELETE CASCADE,
365
370
  CONSTRAINT achievement_rewards_table_fkey
366
371
  FOREIGN KEY(achievement_rewards_table_id)
367
- REFERENCES metaschema_public.table (id)
372
+ REFERENCES metaschema_public."table" (id)
368
373
  ON DELETE CASCADE,
369
374
  CONSTRAINT entity_table_fkey
370
375
  FOREIGN KEY(entity_table_id)
371
- REFERENCES metaschema_public.table (id)
376
+ REFERENCES metaschema_public."table" (id)
372
377
  ON DELETE CASCADE,
373
378
  CONSTRAINT actor_table_fkey
374
379
  FOREIGN KEY(actor_table_id)
375
- REFERENCES metaschema_public.table (id)
380
+ REFERENCES metaschema_public."table" (id)
376
381
  ON DELETE CASCADE
377
382
  );
378
383
 
@@ -425,59 +430,59 @@ CREATE TABLE metaschema_modules_public.limits_module (
425
430
  ON DELETE CASCADE,
426
431
  CONSTRAINT table_fkey
427
432
  FOREIGN KEY(table_id)
428
- REFERENCES metaschema_public.table (id)
433
+ REFERENCES metaschema_public."table" (id)
429
434
  ON DELETE CASCADE,
430
435
  CONSTRAINT default_table_fkey
431
436
  FOREIGN KEY(default_table_id)
432
- REFERENCES metaschema_public.table (id)
437
+ REFERENCES metaschema_public."table" (id)
433
438
  ON DELETE CASCADE,
434
439
  CONSTRAINT entity_table_fkey
435
440
  FOREIGN KEY(entity_table_id)
436
- REFERENCES metaschema_public.table (id)
441
+ REFERENCES metaschema_public."table" (id)
437
442
  ON DELETE CASCADE,
438
443
  CONSTRAINT actor_table_fkey
439
444
  FOREIGN KEY(actor_table_id)
440
- REFERENCES metaschema_public.table (id)
445
+ REFERENCES metaschema_public."table" (id)
441
446
  ON DELETE CASCADE,
442
447
  CONSTRAINT aggregate_table_fkey
443
448
  FOREIGN KEY(aggregate_table_id)
444
- REFERENCES metaschema_public.table (id)
449
+ REFERENCES metaschema_public."table" (id)
445
450
  ON DELETE CASCADE,
446
451
  CONSTRAINT limit_credits_table_fkey
447
452
  FOREIGN KEY(limit_credits_table_id)
448
- REFERENCES metaschema_public.table (id)
453
+ REFERENCES metaschema_public."table" (id)
449
454
  ON DELETE CASCADE,
450
455
  CONSTRAINT events_table_fkey
451
456
  FOREIGN KEY(events_table_id)
452
- REFERENCES metaschema_public.table (id)
457
+ REFERENCES metaschema_public."table" (id)
453
458
  ON DELETE CASCADE,
454
459
  CONSTRAINT credit_codes_table_fkey
455
460
  FOREIGN KEY(credit_codes_table_id)
456
- REFERENCES metaschema_public.table (id)
461
+ REFERENCES metaschema_public."table" (id)
457
462
  ON DELETE CASCADE,
458
463
  CONSTRAINT credit_code_items_table_fkey
459
464
  FOREIGN KEY(credit_code_items_table_id)
460
- REFERENCES metaschema_public.table (id)
465
+ REFERENCES metaschema_public."table" (id)
461
466
  ON DELETE CASCADE,
462
467
  CONSTRAINT credit_redemptions_table_fkey
463
468
  FOREIGN KEY(credit_redemptions_table_id)
464
- REFERENCES metaschema_public.table (id)
469
+ REFERENCES metaschema_public."table" (id)
465
470
  ON DELETE CASCADE,
466
471
  CONSTRAINT limit_caps_table_fkey
467
472
  FOREIGN KEY(limit_caps_table_id)
468
- REFERENCES metaschema_public.table (id)
473
+ REFERENCES metaschema_public."table" (id)
469
474
  ON DELETE CASCADE,
470
475
  CONSTRAINT limit_caps_defaults_table_fkey
471
476
  FOREIGN KEY(limit_caps_defaults_table_id)
472
- REFERENCES metaschema_public.table (id)
477
+ REFERENCES metaschema_public."table" (id)
473
478
  ON DELETE CASCADE,
474
479
  CONSTRAINT limit_warnings_table_fkey
475
480
  FOREIGN KEY(limit_warnings_table_id)
476
- REFERENCES metaschema_public.table (id)
481
+ REFERENCES metaschema_public."table" (id)
477
482
  ON DELETE CASCADE,
478
483
  CONSTRAINT limit_warning_state_table_fkey
479
484
  FOREIGN KEY(limit_warning_state_table_id)
480
- REFERENCES metaschema_public.table (id)
485
+ REFERENCES metaschema_public."table" (id)
481
486
  ON DELETE CASCADE
482
487
  );
483
488
 
@@ -499,7 +504,7 @@ CREATE TABLE metaschema_modules_public.membership_types_module (
499
504
  ON DELETE CASCADE,
500
505
  CONSTRAINT table_fkey
501
506
  FOREIGN KEY(table_id)
502
- REFERENCES metaschema_public.table (id)
507
+ REFERENCES metaschema_public."table" (id)
503
508
  ON DELETE CASCADE
504
509
  );
505
510
 
@@ -534,6 +539,7 @@ CREATE TABLE metaschema_modules_public.memberships_module (
534
539
  entity_table_id uuid NULL,
535
540
  entity_table_owner_id uuid NULL,
536
541
  prefix text NULL,
542
+ get_org_fn text NULL,
537
543
  actor_mask_check text NOT NULL DEFAULT '',
538
544
  actor_perm_check text NOT NULL DEFAULT '',
539
545
  entity_ids_by_mask text NULL,
@@ -554,31 +560,31 @@ CREATE TABLE metaschema_modules_public.memberships_module (
554
560
  ON DELETE CASCADE,
555
561
  CONSTRAINT memberships_table_fkey
556
562
  FOREIGN KEY(memberships_table_id)
557
- REFERENCES metaschema_public.table (id)
563
+ REFERENCES metaschema_public."table" (id)
558
564
  ON DELETE CASCADE,
559
565
  CONSTRAINT membership_defaults_table_fkey
560
566
  FOREIGN KEY(membership_defaults_table_id)
561
- REFERENCES metaschema_public.table (id)
567
+ REFERENCES metaschema_public."table" (id)
562
568
  ON DELETE CASCADE,
563
569
  CONSTRAINT membership_settings_table_fkey
564
570
  FOREIGN KEY(membership_settings_table_id)
565
- REFERENCES metaschema_public.table (id)
571
+ REFERENCES metaschema_public."table" (id)
566
572
  ON DELETE CASCADE,
567
573
  CONSTRAINT members_table_fkey
568
574
  FOREIGN KEY(members_table_id)
569
- REFERENCES metaschema_public.table (id)
575
+ REFERENCES metaschema_public."table" (id)
570
576
  ON DELETE CASCADE,
571
577
  CONSTRAINT grants_table_fkey
572
578
  FOREIGN KEY(grants_table_id)
573
- REFERENCES metaschema_public.table (id)
579
+ REFERENCES metaschema_public."table" (id)
574
580
  ON DELETE CASCADE,
575
581
  CONSTRAINT sprt_table_fkey
576
582
  FOREIGN KEY(sprt_table_id)
577
- REFERENCES metaschema_public.table (id)
583
+ REFERENCES metaschema_public."table" (id)
578
584
  ON DELETE CASCADE,
579
585
  CONSTRAINT entity_table_fkey
580
586
  FOREIGN KEY(entity_table_id)
581
- REFERENCES metaschema_public.table (id)
587
+ REFERENCES metaschema_public."table" (id)
582
588
  ON DELETE CASCADE,
583
589
  CONSTRAINT entity_table_owner_fkey
584
590
  FOREIGN KEY(entity_table_owner_id)
@@ -586,23 +592,23 @@ CREATE TABLE metaschema_modules_public.memberships_module (
586
592
  ON DELETE CASCADE,
587
593
  CONSTRAINT actor_table_fkey
588
594
  FOREIGN KEY(actor_table_id)
589
- REFERENCES metaschema_public.table (id)
595
+ REFERENCES metaschema_public."table" (id)
590
596
  ON DELETE CASCADE,
591
597
  CONSTRAINT limits_table_fkey
592
598
  FOREIGN KEY(limits_table_id)
593
- REFERENCES metaschema_public.table (id)
599
+ REFERENCES metaschema_public."table" (id)
594
600
  ON DELETE CASCADE,
595
601
  CONSTRAINT default_limits_table_fkey
596
602
  FOREIGN KEY(default_limits_table_id)
597
- REFERENCES metaschema_public.table (id)
603
+ REFERENCES metaschema_public."table" (id)
598
604
  ON DELETE CASCADE,
599
605
  CONSTRAINT permissions_table_fkey
600
606
  FOREIGN KEY(permissions_table_id)
601
- REFERENCES metaschema_public.table (id)
607
+ REFERENCES metaschema_public."table" (id)
602
608
  ON DELETE CASCADE,
603
609
  CONSTRAINT default_permissions_table_fkey
604
610
  FOREIGN KEY(default_permissions_table_id)
605
- REFERENCES metaschema_public.table (id)
611
+ REFERENCES metaschema_public."table" (id)
606
612
  ON DELETE CASCADE
607
613
  );
608
614
 
@@ -640,19 +646,19 @@ CREATE TABLE metaschema_modules_public.permissions_module (
640
646
  ON DELETE CASCADE,
641
647
  CONSTRAINT table_fkey
642
648
  FOREIGN KEY(table_id)
643
- REFERENCES metaschema_public.table (id)
649
+ REFERENCES metaschema_public."table" (id)
644
650
  ON DELETE CASCADE,
645
651
  CONSTRAINT default_table_fkey
646
652
  FOREIGN KEY(default_table_id)
647
- REFERENCES metaschema_public.table (id)
653
+ REFERENCES metaschema_public."table" (id)
648
654
  ON DELETE CASCADE,
649
655
  CONSTRAINT entity_table_fkey
650
656
  FOREIGN KEY(entity_table_id)
651
- REFERENCES metaschema_public.table (id)
657
+ REFERENCES metaschema_public."table" (id)
652
658
  ON DELETE CASCADE,
653
659
  CONSTRAINT actor_table_fkey
654
660
  FOREIGN KEY(actor_table_id)
655
- REFERENCES metaschema_public.table (id)
661
+ REFERENCES metaschema_public."table" (id)
656
662
  ON DELETE CASCADE
657
663
  );
658
664
 
@@ -672,11 +678,11 @@ CREATE TABLE metaschema_modules_public.phone_numbers_module (
672
678
  ON DELETE CASCADE,
673
679
  CONSTRAINT table_fkey
674
680
  FOREIGN KEY(table_id)
675
- REFERENCES metaschema_public.table (id)
681
+ REFERENCES metaschema_public."table" (id)
676
682
  ON DELETE CASCADE,
677
683
  CONSTRAINT owner_table_fkey
678
684
  FOREIGN KEY(owner_table_id)
679
- REFERENCES metaschema_public.table (id)
685
+ REFERENCES metaschema_public."table" (id)
680
686
  ON DELETE CASCADE,
681
687
  CONSTRAINT schema_fkey
682
688
  FOREIGN KEY(schema_id)
@@ -725,39 +731,39 @@ CREATE TABLE metaschema_modules_public.profiles_module (
725
731
  ON DELETE CASCADE,
726
732
  CONSTRAINT table_fkey
727
733
  FOREIGN KEY(table_id)
728
- REFERENCES metaschema_public.table (id)
734
+ REFERENCES metaschema_public."table" (id)
729
735
  ON DELETE CASCADE,
730
736
  CONSTRAINT profile_permissions_table_fkey
731
737
  FOREIGN KEY(profile_permissions_table_id)
732
- REFERENCES metaschema_public.table (id)
738
+ REFERENCES metaschema_public."table" (id)
733
739
  ON DELETE CASCADE,
734
740
  CONSTRAINT profile_grants_table_fkey
735
741
  FOREIGN KEY(profile_grants_table_id)
736
- REFERENCES metaschema_public.table (id)
742
+ REFERENCES metaschema_public."table" (id)
737
743
  ON DELETE CASCADE,
738
744
  CONSTRAINT profile_definition_grants_table_fkey
739
745
  FOREIGN KEY(profile_definition_grants_table_id)
740
- REFERENCES metaschema_public.table (id)
746
+ REFERENCES metaschema_public."table" (id)
741
747
  ON DELETE CASCADE,
742
748
  CONSTRAINT profile_templates_table_fkey
743
749
  FOREIGN KEY(profile_templates_table_id)
744
- REFERENCES metaschema_public.table (id)
750
+ REFERENCES metaschema_public."table" (id)
745
751
  ON DELETE CASCADE,
746
752
  CONSTRAINT entity_table_fkey
747
753
  FOREIGN KEY(entity_table_id)
748
- REFERENCES metaschema_public.table (id)
754
+ REFERENCES metaschema_public."table" (id)
749
755
  ON DELETE CASCADE,
750
756
  CONSTRAINT actor_table_fkey
751
757
  FOREIGN KEY(actor_table_id)
752
- REFERENCES metaschema_public.table (id)
758
+ REFERENCES metaschema_public."table" (id)
753
759
  ON DELETE CASCADE,
754
760
  CONSTRAINT permissions_table_fkey
755
761
  FOREIGN KEY(permissions_table_id)
756
- REFERENCES metaschema_public.table (id)
762
+ REFERENCES metaschema_public."table" (id)
757
763
  ON DELETE CASCADE,
758
764
  CONSTRAINT memberships_table_fkey
759
765
  FOREIGN KEY(memberships_table_id)
760
- REFERENCES metaschema_public.table (id)
766
+ REFERENCES metaschema_public."table" (id)
761
767
  ON DELETE CASCADE,
762
768
  CONSTRAINT profiles_module_unique
763
769
  UNIQUE (database_id, membership_type)
@@ -783,15 +789,15 @@ CREATE TABLE metaschema_modules_public.rls_module (
783
789
  ON DELETE CASCADE,
784
790
  CONSTRAINT session_credentials_table_fkey
785
791
  FOREIGN KEY(session_credentials_table_id)
786
- REFERENCES metaschema_public.table (id)
792
+ REFERENCES metaschema_public."table" (id)
787
793
  ON DELETE CASCADE,
788
794
  CONSTRAINT sessions_table_fkey
789
795
  FOREIGN KEY(sessions_table_id)
790
- REFERENCES metaschema_public.table (id)
796
+ REFERENCES metaschema_public."table" (id)
791
797
  ON DELETE CASCADE,
792
798
  CONSTRAINT users_table_fkey
793
799
  FOREIGN KEY(users_table_id)
794
- REFERENCES metaschema_public.table (id)
800
+ REFERENCES metaschema_public."table" (id)
795
801
  ON DELETE CASCADE,
796
802
  CONSTRAINT schema_fkey
797
803
  FOREIGN KEY(schema_id)
@@ -831,7 +837,7 @@ CREATE TABLE metaschema_modules_public.user_state_module (
831
837
  ON DELETE CASCADE,
832
838
  CONSTRAINT table_fkey
833
839
  FOREIGN KEY(table_id)
834
- REFERENCES metaschema_public.table (id)
840
+ REFERENCES metaschema_public."table" (id)
835
841
  ON DELETE CASCADE
836
842
  );
837
843
 
@@ -859,19 +865,19 @@ CREATE TABLE metaschema_modules_public.sessions_module (
859
865
  ON DELETE CASCADE,
860
866
  CONSTRAINT sessions_table_fkey
861
867
  FOREIGN KEY(sessions_table_id)
862
- REFERENCES metaschema_public.table (id)
868
+ REFERENCES metaschema_public."table" (id)
863
869
  ON DELETE CASCADE,
864
870
  CONSTRAINT session_credentials_table_fkey
865
871
  FOREIGN KEY(session_credentials_table_id)
866
- REFERENCES metaschema_public.table (id)
872
+ REFERENCES metaschema_public."table" (id)
867
873
  ON DELETE CASCADE,
868
874
  CONSTRAINT auth_settings_table_fkey
869
875
  FOREIGN KEY(auth_settings_table_id)
870
- REFERENCES metaschema_public.table (id)
876
+ REFERENCES metaschema_public."table" (id)
871
877
  ON DELETE CASCADE,
872
878
  CONSTRAINT users_table_fkey
873
879
  FOREIGN KEY(users_table_id)
874
- REFERENCES metaschema_public.table (id)
880
+ REFERENCES metaschema_public."table" (id)
875
881
  ON DELETE CASCADE
876
882
  );
877
883
 
@@ -920,27 +926,27 @@ CREATE TABLE metaschema_modules_public.user_auth_module (
920
926
  ON DELETE CASCADE,
921
927
  CONSTRAINT email_table_fkey
922
928
  FOREIGN KEY(emails_table_id)
923
- REFERENCES metaschema_public.table (id)
929
+ REFERENCES metaschema_public."table" (id)
924
930
  ON DELETE CASCADE,
925
931
  CONSTRAINT users_table_fkey
926
932
  FOREIGN KEY(users_table_id)
927
- REFERENCES metaschema_public.table (id)
933
+ REFERENCES metaschema_public."table" (id)
928
934
  ON DELETE CASCADE,
929
935
  CONSTRAINT secrets_table_fkey
930
936
  FOREIGN KEY(secrets_table_id)
931
- REFERENCES metaschema_public.table (id)
937
+ REFERENCES metaschema_public."table" (id)
932
938
  ON DELETE CASCADE,
933
939
  CONSTRAINT encrypted_table_fkey
934
940
  FOREIGN KEY(encrypted_table_id)
935
- REFERENCES metaschema_public.table (id)
941
+ REFERENCES metaschema_public."table" (id)
936
942
  ON DELETE CASCADE,
937
943
  CONSTRAINT sessions_table_fkey
938
944
  FOREIGN KEY(sessions_table_id)
939
- REFERENCES metaschema_public.table (id)
945
+ REFERENCES metaschema_public."table" (id)
940
946
  ON DELETE CASCADE,
941
947
  CONSTRAINT session_credentials_table_fkey
942
948
  FOREIGN KEY(session_credentials_table_id)
943
- REFERENCES metaschema_public.table (id)
949
+ REFERENCES metaschema_public."table" (id)
944
950
  ON DELETE CASCADE
945
951
  );
946
952
 
@@ -976,11 +982,11 @@ CREATE TABLE metaschema_modules_public.users_module (
976
982
  ON DELETE CASCADE,
977
983
  CONSTRAINT table_fkey
978
984
  FOREIGN KEY(table_id)
979
- REFERENCES metaschema_public.table (id)
985
+ REFERENCES metaschema_public."table" (id)
980
986
  ON DELETE CASCADE,
981
987
  CONSTRAINT type_table_fkey
982
988
  FOREIGN KEY(type_table_id)
983
- REFERENCES metaschema_public.table (id)
989
+ REFERENCES metaschema_public."table" (id)
984
990
  ON DELETE CASCADE
985
991
  );
986
992
 
@@ -1021,23 +1027,23 @@ CREATE TABLE metaschema_modules_public.hierarchy_module (
1021
1027
  ON DELETE CASCADE,
1022
1028
  CONSTRAINT chart_edges_table_fkey
1023
1029
  FOREIGN KEY(chart_edges_table_id)
1024
- REFERENCES metaschema_public.table (id)
1030
+ REFERENCES metaschema_public."table" (id)
1025
1031
  ON DELETE CASCADE,
1026
1032
  CONSTRAINT hierarchy_sprt_table_fkey
1027
1033
  FOREIGN KEY(hierarchy_sprt_table_id)
1028
- REFERENCES metaschema_public.table (id)
1034
+ REFERENCES metaschema_public."table" (id)
1029
1035
  ON DELETE CASCADE,
1030
1036
  CONSTRAINT chart_edge_grants_table_fkey
1031
1037
  FOREIGN KEY(chart_edge_grants_table_id)
1032
- REFERENCES metaschema_public.table (id)
1038
+ REFERENCES metaschema_public."table" (id)
1033
1039
  ON DELETE CASCADE,
1034
1040
  CONSTRAINT entity_table_fkey
1035
1041
  FOREIGN KEY(entity_table_id)
1036
- REFERENCES metaschema_public.table (id)
1042
+ REFERENCES metaschema_public."table" (id)
1037
1043
  ON DELETE CASCADE,
1038
1044
  CONSTRAINT users_table_fkey
1039
1045
  FOREIGN KEY(users_table_id)
1040
- REFERENCES metaschema_public.table (id)
1046
+ REFERENCES metaschema_public."table" (id)
1041
1047
  ON DELETE CASCADE,
1042
1048
  CONSTRAINT hierarchy_module_database_unique
1043
1049
  UNIQUE (database_id)
@@ -1063,7 +1069,7 @@ CREATE TABLE metaschema_modules_public.secure_table_provision (
1063
1069
  ON DELETE CASCADE,
1064
1070
  CONSTRAINT table_fkey
1065
1071
  FOREIGN KEY(table_id)
1066
- REFERENCES metaschema_public.table (id)
1072
+ REFERENCES metaschema_public."table" (id)
1067
1073
  ON DELETE CASCADE,
1068
1074
  CONSTRAINT schema_fkey
1069
1075
  FOREIGN KEY(schema_id)
@@ -1130,11 +1136,11 @@ CREATE TABLE metaschema_modules_public.relation_provision (
1130
1136
  ON DELETE CASCADE,
1131
1137
  CONSTRAINT source_table_fkey
1132
1138
  FOREIGN KEY(source_table_id)
1133
- REFERENCES metaschema_public.table (id)
1139
+ REFERENCES metaschema_public."table" (id)
1134
1140
  ON DELETE CASCADE,
1135
1141
  CONSTRAINT target_table_fkey
1136
1142
  FOREIGN KEY(target_table_id)
1137
- REFERENCES metaschema_public.table (id)
1143
+ REFERENCES metaschema_public."table" (id)
1138
1144
  ON DELETE CASCADE
1139
1145
  );
1140
1146
 
@@ -1457,7 +1463,7 @@ CREATE TABLE metaschema_modules_public.storage_module (
1457
1463
  buckets_table_name text NOT NULL DEFAULT 'app_buckets',
1458
1464
  files_table_name text NOT NULL DEFAULT 'app_files',
1459
1465
  membership_type int DEFAULT NULL,
1460
- storage_key text NOT NULL DEFAULT 'default',
1466
+ key text NOT NULL DEFAULT 'default',
1461
1467
  policies jsonb NULL,
1462
1468
  provisions jsonb NULL,
1463
1469
  entity_table_id uuid NULL,
@@ -1496,29 +1502,29 @@ CREATE TABLE metaschema_modules_public.storage_module (
1496
1502
  ON DELETE CASCADE,
1497
1503
  CONSTRAINT buckets_table_fkey
1498
1504
  FOREIGN KEY(buckets_table_id)
1499
- REFERENCES metaschema_public.table (id)
1505
+ REFERENCES metaschema_public."table" (id)
1500
1506
  ON DELETE CASCADE,
1501
1507
  CONSTRAINT files_table_fkey
1502
1508
  FOREIGN KEY(files_table_id)
1503
- REFERENCES metaschema_public.table (id)
1509
+ REFERENCES metaschema_public."table" (id)
1504
1510
  ON DELETE CASCADE,
1505
1511
  CONSTRAINT entity_table_fkey
1506
1512
  FOREIGN KEY(entity_table_id)
1507
- REFERENCES metaschema_public.table (id)
1513
+ REFERENCES metaschema_public."table" (id)
1508
1514
  ON DELETE CASCADE,
1509
1515
  CONSTRAINT path_shares_table_fkey
1510
1516
  FOREIGN KEY(path_shares_table_id)
1511
- REFERENCES metaschema_public.table (id)
1517
+ REFERENCES metaschema_public."table" (id)
1512
1518
  ON DELETE CASCADE,
1513
1519
  CONSTRAINT file_events_table_fkey
1514
1520
  FOREIGN KEY(file_events_table_id)
1515
- REFERENCES metaschema_public.table (id)
1521
+ REFERENCES metaschema_public."table" (id)
1516
1522
  ON DELETE CASCADE
1517
1523
  );
1518
1524
 
1519
1525
  CREATE INDEX storage_module_database_id_idx ON metaschema_modules_public.storage_module (database_id);
1520
1526
 
1521
- CREATE UNIQUE INDEX storage_module_unique_scope ON metaschema_modules_public.storage_module (database_id, (COALESCE(membership_type, -1)), storage_key);
1527
+ CREATE UNIQUE INDEX storage_module_unique_scope ON metaschema_modules_public.storage_module (database_id, (COALESCE(membership_type, -1)), key);
1522
1528
 
1523
1529
  CREATE TABLE metaschema_modules_public.entity_type_provision (
1524
1530
  id uuid PRIMARY KEY DEFAULT uuidv7(),
@@ -1557,6 +1563,9 @@ CREATE TABLE metaschema_modules_public.entity_type_provision (
1557
1563
  out_definitions_table_id uuid DEFAULT NULL,
1558
1564
  out_invocations_table_id uuid DEFAULT NULL,
1559
1565
  out_execution_logs_table_id uuid DEFAULT NULL,
1566
+ out_secret_definitions_table_id uuid DEFAULT NULL,
1567
+ out_requirements_table_id uuid DEFAULT NULL,
1568
+ out_config_requirements_table_id uuid DEFAULT NULL,
1560
1569
  out_graph_module_id uuid DEFAULT NULL,
1561
1570
  out_graphs_table_id uuid DEFAULT NULL,
1562
1571
  out_agent_module_id uuid DEFAULT NULL,
@@ -1693,12 +1702,13 @@ COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.out_installed_
1693
1702
  COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.storage IS 'Optional JSON array of storage module definitions. Presence triggers provisioning
1694
1703
  (same inference model as namespaces, functions, agents).
1695
1704
  Each element provisions a separate storage module with its own tables
1696
- ({prefix}_{storage_key}_buckets/files), RLS policies, and feature flags.
1705
+ ({prefix}_{key}_buckets/files), RLS policies, and feature flags.
1697
1706
  NULL = do not provision storage. ''[{}]'' = provision one default storage module.
1698
1707
  Each array element recognizes (all optional):
1699
- - storage_key (text) module discriminator, max 16 chars, lowercase snake_case.
1708
+ - key (text) module discriminator, max 16 chars, lowercase snake_case.
1700
1709
  Defaults to ''default'' (omitted from table names).
1701
1710
  Non-default keys become infixes: {prefix}_{key}_buckets.
1711
+ (storage_key accepted for backward compat)
1702
1712
  - upload_url_expiry_seconds (integer) presigned PUT URL expiry override
1703
1713
  - download_url_expiry_seconds (integer) presigned GET URL expiry override
1704
1714
  - default_max_file_size (bigint) global max file size in bytes for this module
@@ -1718,7 +1728,7 @@ COMMENT ON COLUMN metaschema_modules_public.entity_type_provision.storage IS 'Op
1718
1728
  Example (single module, backward compat):
1719
1729
  storage := ''[{"buckets": [{"name": "documents"}]}]''::jsonb
1720
1730
  Example (multi-module):
1721
- storage := ''[{"has_path_shares": true, "buckets": [{"name": "documents"}]}, {"storage_key": "fn", "has_custom_keys": true, "buckets": [{"name": "functions"}]}]''::jsonb';
1731
+ storage := ''[{"has_path_shares": true, "buckets": [{"name": "documents"}]}, {"key": "fn", "has_custom_keys": true, "buckets": [{"name": "functions"}]}]''::jsonb';
1722
1732
 
1723
1733
  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
1734
 
@@ -1790,15 +1800,15 @@ CREATE TABLE metaschema_modules_public.rate_limits_module (
1790
1800
  ON DELETE CASCADE,
1791
1801
  CONSTRAINT rate_limit_settings_table_fkey
1792
1802
  FOREIGN KEY(rate_limit_settings_table_id)
1793
- REFERENCES metaschema_public.table (id)
1803
+ REFERENCES metaschema_public."table" (id)
1794
1804
  ON DELETE CASCADE,
1795
1805
  CONSTRAINT ip_rate_limits_table_fkey
1796
1806
  FOREIGN KEY(ip_rate_limits_table_id)
1797
- REFERENCES metaschema_public.table (id)
1807
+ REFERENCES metaschema_public."table" (id)
1798
1808
  ON DELETE CASCADE,
1799
1809
  CONSTRAINT rate_limits_table_fkey
1800
1810
  FOREIGN KEY(rate_limits_table_id)
1801
- REFERENCES metaschema_public.table (id)
1811
+ REFERENCES metaschema_public."table" (id)
1802
1812
  ON DELETE CASCADE,
1803
1813
  CONSTRAINT rate_limits_module_database_id_uniq
1804
1814
  UNIQUE (database_id)
@@ -1830,11 +1840,11 @@ CREATE TABLE metaschema_modules_public.devices_module (
1830
1840
  ON DELETE CASCADE,
1831
1841
  CONSTRAINT user_devices_table_fkey
1832
1842
  FOREIGN KEY(user_devices_table_id)
1833
- REFERENCES metaschema_public.table (id)
1843
+ REFERENCES metaschema_public."table" (id)
1834
1844
  ON DELETE CASCADE,
1835
1845
  CONSTRAINT device_settings_table_fkey
1836
1846
  FOREIGN KEY(device_settings_table_id)
1837
- REFERENCES metaschema_public.table (id)
1847
+ REFERENCES metaschema_public."table" (id)
1838
1848
  ON DELETE CASCADE,
1839
1849
  CONSTRAINT devices_module_database_id_uniq
1840
1850
  UNIQUE (database_id)
@@ -1863,11 +1873,11 @@ CREATE TABLE metaschema_modules_public.session_secrets_module (
1863
1873
  ON DELETE CASCADE,
1864
1874
  CONSTRAINT table_fkey
1865
1875
  FOREIGN KEY(table_id)
1866
- REFERENCES metaschema_public.table (id)
1876
+ REFERENCES metaschema_public."table" (id)
1867
1877
  ON DELETE CASCADE,
1868
1878
  CONSTRAINT sessions_table_fkey
1869
1879
  FOREIGN KEY(sessions_table_id)
1870
- REFERENCES metaschema_public.table (id)
1880
+ REFERENCES metaschema_public."table" (id)
1871
1881
  ON DELETE CASCADE
1872
1882
  );
1873
1883
 
@@ -1897,11 +1907,11 @@ CREATE TABLE metaschema_modules_public.webauthn_credentials_module (
1897
1907
  ON DELETE CASCADE,
1898
1908
  CONSTRAINT table_fkey
1899
1909
  FOREIGN KEY(table_id)
1900
- REFERENCES metaschema_public.table (id)
1910
+ REFERENCES metaschema_public."table" (id)
1901
1911
  ON DELETE CASCADE,
1902
1912
  CONSTRAINT owner_table_fkey
1903
1913
  FOREIGN KEY(owner_table_id)
1904
- REFERENCES metaschema_public.table (id)
1914
+ REFERENCES metaschema_public."table" (id)
1905
1915
  ON DELETE CASCADE,
1906
1916
  CONSTRAINT schema_fkey
1907
1917
  FOREIGN KEY(schema_id)
@@ -1946,27 +1956,27 @@ CREATE TABLE metaschema_modules_public.webauthn_auth_module (
1946
1956
  ON DELETE CASCADE,
1947
1957
  CONSTRAINT users_table_fkey
1948
1958
  FOREIGN KEY(users_table_id)
1949
- REFERENCES metaschema_public.table (id)
1959
+ REFERENCES metaschema_public."table" (id)
1950
1960
  ON DELETE CASCADE,
1951
1961
  CONSTRAINT credentials_table_fkey
1952
1962
  FOREIGN KEY(credentials_table_id)
1953
- REFERENCES metaschema_public.table (id)
1963
+ REFERENCES metaschema_public."table" (id)
1954
1964
  ON DELETE CASCADE,
1955
1965
  CONSTRAINT sessions_table_fkey
1956
1966
  FOREIGN KEY(sessions_table_id)
1957
- REFERENCES metaschema_public.table (id)
1967
+ REFERENCES metaschema_public."table" (id)
1958
1968
  ON DELETE CASCADE,
1959
1969
  CONSTRAINT session_credentials_table_fkey
1960
1970
  FOREIGN KEY(session_credentials_table_id)
1961
- REFERENCES metaschema_public.table (id)
1971
+ REFERENCES metaschema_public."table" (id)
1962
1972
  ON DELETE CASCADE,
1963
1973
  CONSTRAINT session_secrets_table_fkey
1964
1974
  FOREIGN KEY(session_secrets_table_id)
1965
- REFERENCES metaschema_public.table (id)
1975
+ REFERENCES metaschema_public."table" (id)
1966
1976
  ON DELETE CASCADE,
1967
1977
  CONSTRAINT auth_settings_table_fkey
1968
1978
  FOREIGN KEY(auth_settings_table_id)
1969
- REFERENCES metaschema_public.table (id)
1979
+ REFERENCES metaschema_public."table" (id)
1970
1980
  ON DELETE CASCADE
1971
1981
  );
1972
1982
 
@@ -1985,7 +1995,7 @@ CREATE TABLE metaschema_modules_public.identity_providers_module (
1985
1995
  ON DELETE CASCADE,
1986
1996
  CONSTRAINT table_fkey
1987
1997
  FOREIGN KEY(table_id)
1988
- REFERENCES metaschema_public.table (id)
1998
+ REFERENCES metaschema_public."table" (id)
1989
1999
  ON DELETE CASCADE,
1990
2000
  CONSTRAINT schema_fkey
1991
2001
  FOREIGN KEY(schema_id)
@@ -2033,35 +2043,35 @@ CREATE TABLE metaschema_modules_public.notifications_module (
2033
2043
  ON DELETE CASCADE,
2034
2044
  CONSTRAINT notifications_table_fkey
2035
2045
  FOREIGN KEY(notifications_table_id)
2036
- REFERENCES metaschema_public.table (id)
2046
+ REFERENCES metaschema_public."table" (id)
2037
2047
  ON DELETE CASCADE,
2038
2048
  CONSTRAINT read_state_table_fkey
2039
2049
  FOREIGN KEY(read_state_table_id)
2040
- REFERENCES metaschema_public.table (id)
2050
+ REFERENCES metaschema_public."table" (id)
2041
2051
  ON DELETE CASCADE,
2042
2052
  CONSTRAINT preferences_table_fkey
2043
2053
  FOREIGN KEY(preferences_table_id)
2044
- REFERENCES metaschema_public.table (id)
2054
+ REFERENCES metaschema_public."table" (id)
2045
2055
  ON DELETE SET NULL,
2046
2056
  CONSTRAINT channels_table_fkey
2047
2057
  FOREIGN KEY(channels_table_id)
2048
- REFERENCES metaschema_public.table (id)
2058
+ REFERENCES metaschema_public."table" (id)
2049
2059
  ON DELETE SET NULL,
2050
2060
  CONSTRAINT delivery_log_table_fkey
2051
2061
  FOREIGN KEY(delivery_log_table_id)
2052
- REFERENCES metaschema_public.table (id)
2062
+ REFERENCES metaschema_public."table" (id)
2053
2063
  ON DELETE SET NULL,
2054
2064
  CONSTRAINT owner_table_fkey
2055
2065
  FOREIGN KEY(owner_table_id)
2056
- REFERENCES metaschema_public.table (id)
2066
+ REFERENCES metaschema_public."table" (id)
2057
2067
  ON DELETE CASCADE,
2058
2068
  CONSTRAINT user_settings_table_fkey
2059
2069
  FOREIGN KEY(user_settings_table_id)
2060
- REFERENCES metaschema_public.table (id)
2070
+ REFERENCES metaschema_public."table" (id)
2061
2071
  ON DELETE SET NULL,
2062
2072
  CONSTRAINT organization_settings_table_fkey
2063
2073
  FOREIGN KEY(organization_settings_table_id)
2064
- REFERENCES metaschema_public.table (id)
2074
+ REFERENCES metaschema_public."table" (id)
2065
2075
  ON DELETE SET NULL,
2066
2076
  CONSTRAINT schema_fkey
2067
2077
  FOREIGN KEY(schema_id)
@@ -2132,19 +2142,19 @@ CREATE TABLE metaschema_modules_public.plans_module (
2132
2142
  ON DELETE CASCADE,
2133
2143
  CONSTRAINT plans_table_fkey
2134
2144
  FOREIGN KEY(plans_table_id)
2135
- REFERENCES metaschema_public.table (id)
2145
+ REFERENCES metaschema_public."table" (id)
2136
2146
  ON DELETE CASCADE,
2137
2147
  CONSTRAINT plan_limits_table_fkey
2138
2148
  FOREIGN KEY(plan_limits_table_id)
2139
- REFERENCES metaschema_public.table (id)
2149
+ REFERENCES metaschema_public."table" (id)
2140
2150
  ON DELETE CASCADE,
2141
2151
  CONSTRAINT plan_pricing_table_fkey
2142
2152
  FOREIGN KEY(plan_pricing_table_id)
2143
- REFERENCES metaschema_public.table (id)
2153
+ REFERENCES metaschema_public."table" (id)
2144
2154
  ON DELETE CASCADE,
2145
2155
  CONSTRAINT plan_overrides_table_fkey
2146
2156
  FOREIGN KEY(plan_overrides_table_id)
2147
- REFERENCES metaschema_public.table (id)
2157
+ REFERENCES metaschema_public."table" (id)
2148
2158
  ON DELETE CASCADE,
2149
2159
  CONSTRAINT plans_module_database_id_unique
2150
2160
  UNIQUE (database_id)
@@ -2185,27 +2195,27 @@ CREATE TABLE metaschema_modules_public.billing_module (
2185
2195
  ON DELETE CASCADE,
2186
2196
  CONSTRAINT meters_table_fkey
2187
2197
  FOREIGN KEY(meters_table_id)
2188
- REFERENCES metaschema_public.table (id)
2198
+ REFERENCES metaschema_public."table" (id)
2189
2199
  ON DELETE CASCADE,
2190
2200
  CONSTRAINT plan_subscriptions_table_fkey
2191
2201
  FOREIGN KEY(plan_subscriptions_table_id)
2192
- REFERENCES metaschema_public.table (id)
2202
+ REFERENCES metaschema_public."table" (id)
2193
2203
  ON DELETE CASCADE,
2194
2204
  CONSTRAINT ledger_table_fkey
2195
2205
  FOREIGN KEY(ledger_table_id)
2196
- REFERENCES metaschema_public.table (id)
2206
+ REFERENCES metaschema_public."table" (id)
2197
2207
  ON DELETE CASCADE,
2198
2208
  CONSTRAINT balances_table_fkey
2199
2209
  FOREIGN KEY(balances_table_id)
2200
- REFERENCES metaschema_public.table (id)
2210
+ REFERENCES metaschema_public."table" (id)
2201
2211
  ON DELETE CASCADE,
2202
2212
  CONSTRAINT meter_credits_table_fkey
2203
2213
  FOREIGN KEY(meter_credits_table_id)
2204
- REFERENCES metaschema_public.table (id)
2214
+ REFERENCES metaschema_public."table" (id)
2205
2215
  ON DELETE CASCADE,
2206
2216
  CONSTRAINT meter_sources_table_fkey
2207
2217
  FOREIGN KEY(meter_sources_table_id)
2208
- REFERENCES metaschema_public.table (id)
2218
+ REFERENCES metaschema_public."table" (id)
2209
2219
  ON DELETE CASCADE,
2210
2220
  CONSTRAINT billing_module_database_id_unique
2211
2221
  UNIQUE (database_id)
@@ -2248,35 +2258,35 @@ CREATE TABLE metaschema_modules_public.billing_provider_module (
2248
2258
  ON DELETE CASCADE,
2249
2259
  CONSTRAINT billing_customers_table_fkey
2250
2260
  FOREIGN KEY(billing_customers_table_id)
2251
- REFERENCES metaschema_public.table (id)
2261
+ REFERENCES metaschema_public."table" (id)
2252
2262
  ON DELETE CASCADE,
2253
2263
  CONSTRAINT billing_products_table_fkey
2254
2264
  FOREIGN KEY(billing_products_table_id)
2255
- REFERENCES metaschema_public.table (id)
2265
+ REFERENCES metaschema_public."table" (id)
2256
2266
  ON DELETE CASCADE,
2257
2267
  CONSTRAINT billing_prices_table_fkey
2258
2268
  FOREIGN KEY(billing_prices_table_id)
2259
- REFERENCES metaschema_public.table (id)
2269
+ REFERENCES metaschema_public."table" (id)
2260
2270
  ON DELETE CASCADE,
2261
2271
  CONSTRAINT billing_subscriptions_table_fkey
2262
2272
  FOREIGN KEY(billing_subscriptions_table_id)
2263
- REFERENCES metaschema_public.table (id)
2273
+ REFERENCES metaschema_public."table" (id)
2264
2274
  ON DELETE CASCADE,
2265
2275
  CONSTRAINT billing_webhook_events_table_fkey
2266
2276
  FOREIGN KEY(billing_webhook_events_table_id)
2267
- REFERENCES metaschema_public.table (id)
2277
+ REFERENCES metaschema_public."table" (id)
2268
2278
  ON DELETE CASCADE,
2269
2279
  CONSTRAINT products_table_fkey
2270
2280
  FOREIGN KEY(products_table_id)
2271
- REFERENCES metaschema_public.table (id)
2281
+ REFERENCES metaschema_public."table" (id)
2272
2282
  ON DELETE SET NULL,
2273
2283
  CONSTRAINT prices_table_fkey
2274
2284
  FOREIGN KEY(prices_table_id)
2275
- REFERENCES metaschema_public.table (id)
2285
+ REFERENCES metaschema_public."table" (id)
2276
2286
  ON DELETE SET NULL,
2277
2287
  CONSTRAINT subscriptions_table_fkey
2278
2288
  FOREIGN KEY(subscriptions_table_id)
2279
- REFERENCES metaschema_public.table (id)
2289
+ REFERENCES metaschema_public."table" (id)
2280
2290
  ON DELETE SET NULL,
2281
2291
  CONSTRAINT billing_provider_module_database_id_unique
2282
2292
  UNIQUE (database_id)
@@ -2295,7 +2305,7 @@ CREATE TABLE metaschema_modules_public.realtime_module (
2295
2305
  source_registry_table_id uuid NOT NULL DEFAULT uuid_nil(),
2296
2306
  retention_hours int NOT NULL DEFAULT 168,
2297
2307
  premake int NOT NULL DEFAULT 7,
2298
- "interval" text NOT NULL DEFAULT '1 day',
2308
+ interval text NOT NULL DEFAULT '1 day',
2299
2309
  notify_channel text NULL,
2300
2310
  CONSTRAINT db_fkey
2301
2311
  FOREIGN KEY(database_id)
@@ -2315,15 +2325,15 @@ CREATE TABLE metaschema_modules_public.realtime_module (
2315
2325
  ON DELETE CASCADE,
2316
2326
  CONSTRAINT change_log_table_fkey
2317
2327
  FOREIGN KEY(change_log_table_id)
2318
- REFERENCES metaschema_public.table (id)
2328
+ REFERENCES metaschema_public."table" (id)
2319
2329
  ON DELETE CASCADE,
2320
2330
  CONSTRAINT listener_node_table_fkey
2321
2331
  FOREIGN KEY(listener_node_table_id)
2322
- REFERENCES metaschema_public.table (id)
2332
+ REFERENCES metaschema_public."table" (id)
2323
2333
  ON DELETE CASCADE,
2324
2334
  CONSTRAINT source_registry_table_fkey
2325
2335
  FOREIGN KEY(source_registry_table_id)
2326
- REFERENCES metaschema_public.table (id)
2336
+ REFERENCES metaschema_public."table" (id)
2327
2337
  ON DELETE CASCADE
2328
2338
  );
2329
2339
 
@@ -2370,15 +2380,15 @@ CREATE TABLE metaschema_modules_public.rate_limit_meters_module (
2370
2380
  ON DELETE CASCADE,
2371
2381
  CONSTRAINT rate_limit_state_table_fkey
2372
2382
  FOREIGN KEY(rate_limit_state_table_id)
2373
- REFERENCES metaschema_public.table (id)
2383
+ REFERENCES metaschema_public."table" (id)
2374
2384
  ON DELETE CASCADE,
2375
2385
  CONSTRAINT rate_limit_overrides_table_fkey
2376
2386
  FOREIGN KEY(rate_limit_overrides_table_id)
2377
- REFERENCES metaschema_public.table (id)
2387
+ REFERENCES metaschema_public."table" (id)
2378
2388
  ON DELETE CASCADE,
2379
2389
  CONSTRAINT rate_window_limits_table_fkey
2380
2390
  FOREIGN KEY(rate_window_limits_table_id)
2381
- REFERENCES metaschema_public.table (id)
2391
+ REFERENCES metaschema_public."table" (id)
2382
2392
  ON DELETE CASCADE,
2383
2393
  CONSTRAINT rate_limit_meters_module_database_id_unique
2384
2394
  UNIQUE (database_id)
@@ -2408,7 +2418,7 @@ CREATE TABLE metaschema_modules_public.config_secrets_org_module (
2408
2418
  ON DELETE CASCADE,
2409
2419
  CONSTRAINT table_fkey
2410
2420
  FOREIGN KEY(table_id)
2411
- REFERENCES metaschema_public.table (id)
2421
+ REFERENCES metaschema_public."table" (id)
2412
2422
  ON DELETE CASCADE
2413
2423
  );
2414
2424
 
@@ -2429,7 +2439,7 @@ CREATE TABLE metaschema_modules_public.inference_log_module (
2429
2439
  inference_log_table_name text NOT NULL DEFAULT '',
2430
2440
  usage_daily_table_id uuid NOT NULL DEFAULT uuid_nil(),
2431
2441
  usage_daily_table_name text NOT NULL DEFAULT '',
2432
- "interval" text NOT NULL DEFAULT '1 month',
2442
+ interval text NOT NULL DEFAULT '1 month',
2433
2443
  retention text NOT NULL DEFAULT '12 months',
2434
2444
  premake int NOT NULL DEFAULT 2,
2435
2445
  scope text NOT NULL DEFAULT 'app',
@@ -2450,11 +2460,11 @@ CREATE TABLE metaschema_modules_public.inference_log_module (
2450
2460
  ON DELETE CASCADE,
2451
2461
  CONSTRAINT inference_log_table_fkey
2452
2462
  FOREIGN KEY(inference_log_table_id)
2453
- REFERENCES metaschema_public.table (id)
2463
+ REFERENCES metaschema_public."table" (id)
2454
2464
  ON DELETE CASCADE,
2455
2465
  CONSTRAINT usage_daily_table_fkey
2456
2466
  FOREIGN KEY(usage_daily_table_id)
2457
- REFERENCES metaschema_public.table (id)
2467
+ REFERENCES metaschema_public."table" (id)
2458
2468
  ON DELETE CASCADE,
2459
2469
  CONSTRAINT inference_log_module_database_id_prefix_unique
2460
2470
  UNIQUE NULLS NOT DISTINCT (database_id, prefix)
@@ -2471,7 +2481,7 @@ CREATE TABLE metaschema_modules_public.compute_log_module (
2471
2481
  compute_log_table_name text NOT NULL DEFAULT '',
2472
2482
  usage_daily_table_id uuid NOT NULL DEFAULT uuid_nil(),
2473
2483
  usage_daily_table_name text NOT NULL DEFAULT '',
2474
- "interval" text NOT NULL DEFAULT '1 month',
2484
+ interval text NOT NULL DEFAULT '1 month',
2475
2485
  retention text NOT NULL DEFAULT '12 months',
2476
2486
  premake int NOT NULL DEFAULT 2,
2477
2487
  scope text NOT NULL DEFAULT 'app',
@@ -2492,11 +2502,11 @@ CREATE TABLE metaschema_modules_public.compute_log_module (
2492
2502
  ON DELETE CASCADE,
2493
2503
  CONSTRAINT compute_log_table_fkey
2494
2504
  FOREIGN KEY(compute_log_table_id)
2495
- REFERENCES metaschema_public.table (id)
2505
+ REFERENCES metaschema_public."table" (id)
2496
2506
  ON DELETE CASCADE,
2497
2507
  CONSTRAINT usage_daily_table_fkey
2498
2508
  FOREIGN KEY(usage_daily_table_id)
2499
- REFERENCES metaschema_public.table (id)
2509
+ REFERENCES metaschema_public."table" (id)
2500
2510
  ON DELETE CASCADE,
2501
2511
  CONSTRAINT compute_log_module_database_id_prefix_unique
2502
2512
  UNIQUE NULLS NOT DISTINCT (database_id, prefix)
@@ -2513,7 +2523,7 @@ CREATE TABLE metaschema_modules_public.transfer_log_module (
2513
2523
  transfer_log_table_name text NOT NULL DEFAULT '',
2514
2524
  usage_daily_table_id uuid NOT NULL DEFAULT uuid_nil(),
2515
2525
  usage_daily_table_name text NOT NULL DEFAULT '',
2516
- "interval" text NOT NULL DEFAULT '1 month',
2526
+ interval text NOT NULL DEFAULT '1 month',
2517
2527
  retention text NOT NULL DEFAULT '12 months',
2518
2528
  premake int NOT NULL DEFAULT 2,
2519
2529
  scope text NOT NULL DEFAULT 'app',
@@ -2534,11 +2544,11 @@ CREATE TABLE metaschema_modules_public.transfer_log_module (
2534
2544
  ON DELETE CASCADE,
2535
2545
  CONSTRAINT transfer_log_table_fkey
2536
2546
  FOREIGN KEY(transfer_log_table_id)
2537
- REFERENCES metaschema_public.table (id)
2547
+ REFERENCES metaschema_public."table" (id)
2538
2548
  ON DELETE CASCADE,
2539
2549
  CONSTRAINT usage_daily_table_fkey
2540
2550
  FOREIGN KEY(usage_daily_table_id)
2541
- REFERENCES metaschema_public.table (id)
2551
+ REFERENCES metaschema_public."table" (id)
2542
2552
  ON DELETE CASCADE,
2543
2553
  CONSTRAINT transfer_log_module_database_id_prefix_unique
2544
2554
  UNIQUE NULLS NOT DISTINCT (database_id, prefix)
@@ -2555,7 +2565,7 @@ CREATE TABLE metaschema_modules_public.storage_log_module (
2555
2565
  storage_log_table_name text NOT NULL DEFAULT '',
2556
2566
  usage_daily_table_id uuid NOT NULL DEFAULT uuid_nil(),
2557
2567
  usage_daily_table_name text NOT NULL DEFAULT '',
2558
- "interval" text NOT NULL DEFAULT '1 month',
2568
+ interval text NOT NULL DEFAULT '1 month',
2559
2569
  retention text NOT NULL DEFAULT '12 months',
2560
2570
  premake int NOT NULL DEFAULT 2,
2561
2571
  scope text NOT NULL DEFAULT 'app',
@@ -2576,11 +2586,11 @@ CREATE TABLE metaschema_modules_public.storage_log_module (
2576
2586
  ON DELETE CASCADE,
2577
2587
  CONSTRAINT storage_log_table_fkey
2578
2588
  FOREIGN KEY(storage_log_table_id)
2579
- REFERENCES metaschema_public.table (id)
2589
+ REFERENCES metaschema_public."table" (id)
2580
2590
  ON DELETE CASCADE,
2581
2591
  CONSTRAINT usage_daily_table_fkey
2582
2592
  FOREIGN KEY(usage_daily_table_id)
2583
- REFERENCES metaschema_public.table (id)
2593
+ REFERENCES metaschema_public."table" (id)
2584
2594
  ON DELETE CASCADE,
2585
2595
  CONSTRAINT storage_log_module_database_id_prefix_unique
2586
2596
  UNIQUE NULLS NOT DISTINCT (database_id, prefix)
@@ -2601,7 +2611,7 @@ CREATE TABLE metaschema_modules_public.db_usage_module (
2601
2611
  query_stats_log_table_name text NOT NULL DEFAULT '',
2602
2612
  query_stats_daily_table_id uuid NOT NULL DEFAULT uuid_nil(),
2603
2613
  query_stats_daily_table_name text NOT NULL DEFAULT '',
2604
- "interval" text NOT NULL DEFAULT '1 month',
2614
+ interval text NOT NULL DEFAULT '1 month',
2605
2615
  retention text NOT NULL DEFAULT '12 months',
2606
2616
  premake int NOT NULL DEFAULT 2,
2607
2617
  scope text NOT NULL DEFAULT 'app',
@@ -2620,19 +2630,19 @@ CREATE TABLE metaschema_modules_public.db_usage_module (
2620
2630
  ON DELETE CASCADE,
2621
2631
  CONSTRAINT table_stats_log_table_fkey
2622
2632
  FOREIGN KEY(table_stats_log_table_id)
2623
- REFERENCES metaschema_public.table (id)
2633
+ REFERENCES metaschema_public."table" (id)
2624
2634
  ON DELETE CASCADE,
2625
2635
  CONSTRAINT table_stats_daily_table_fkey
2626
2636
  FOREIGN KEY(table_stats_daily_table_id)
2627
- REFERENCES metaschema_public.table (id)
2637
+ REFERENCES metaschema_public."table" (id)
2628
2638
  ON DELETE CASCADE,
2629
2639
  CONSTRAINT query_stats_log_table_fkey
2630
2640
  FOREIGN KEY(query_stats_log_table_id)
2631
- REFERENCES metaschema_public.table (id)
2641
+ REFERENCES metaschema_public."table" (id)
2632
2642
  ON DELETE CASCADE,
2633
2643
  CONSTRAINT query_stats_daily_table_fkey
2634
2644
  FOREIGN KEY(query_stats_daily_table_id)
2635
- REFERENCES metaschema_public.table (id)
2645
+ REFERENCES metaschema_public."table" (id)
2636
2646
  ON DELETE CASCADE,
2637
2647
  CONSTRAINT db_usage_module_database_id_prefix_unique
2638
2648
  UNIQUE NULLS NOT DISTINCT (database_id, prefix)
@@ -2658,6 +2668,7 @@ CREATE TABLE metaschema_modules_public.agent_module (
2658
2668
  has_knowledge boolean NOT NULL DEFAULT false,
2659
2669
  api_name text DEFAULT 'agent',
2660
2670
  membership_type int DEFAULT NULL,
2671
+ key text NOT NULL DEFAULT 'default',
2661
2672
  entity_table_id uuid NULL,
2662
2673
  policies jsonb NULL,
2663
2674
  knowledge_config jsonb NULL,
@@ -2677,45 +2688,48 @@ CREATE TABLE metaschema_modules_public.agent_module (
2677
2688
  ON DELETE CASCADE,
2678
2689
  CONSTRAINT agent_module_thread_table_fkey
2679
2690
  FOREIGN KEY(thread_table_id)
2680
- REFERENCES metaschema_public.table (id)
2691
+ REFERENCES metaschema_public."table" (id)
2681
2692
  ON DELETE CASCADE,
2682
2693
  CONSTRAINT agent_module_message_table_fkey
2683
2694
  FOREIGN KEY(message_table_id)
2684
- REFERENCES metaschema_public.table (id)
2695
+ REFERENCES metaschema_public."table" (id)
2685
2696
  ON DELETE CASCADE,
2686
2697
  CONSTRAINT agent_module_task_table_fkey
2687
2698
  FOREIGN KEY(task_table_id)
2688
- REFERENCES metaschema_public.table (id)
2699
+ REFERENCES metaschema_public."table" (id)
2689
2700
  ON DELETE CASCADE,
2690
2701
  CONSTRAINT agent_module_prompts_table_fkey
2691
2702
  FOREIGN KEY(prompts_table_id)
2692
- REFERENCES metaschema_public.table (id)
2703
+ REFERENCES metaschema_public."table" (id)
2693
2704
  ON DELETE CASCADE,
2694
2705
  CONSTRAINT agent_module_knowledge_table_fkey
2695
2706
  FOREIGN KEY(knowledge_table_id)
2696
- REFERENCES metaschema_public.table (id)
2707
+ REFERENCES metaschema_public."table" (id)
2697
2708
  ON DELETE CASCADE,
2698
2709
  CONSTRAINT agent_module_entity_table_fkey
2699
2710
  FOREIGN KEY(entity_table_id)
2700
- REFERENCES metaschema_public.table (id)
2711
+ REFERENCES metaschema_public."table" (id)
2701
2712
  ON DELETE CASCADE
2702
2713
  );
2703
2714
 
2704
2715
  CREATE INDEX agent_module_database_id_idx ON metaschema_modules_public.agent_module (database_id);
2705
2716
 
2706
- CREATE UNIQUE INDEX agent_module_unique_scope ON metaschema_modules_public.agent_module (database_id, (COALESCE(membership_type, -1)));
2717
+ CREATE UNIQUE INDEX agent_module_unique_scope ON metaschema_modules_public.agent_module (database_id, (COALESCE(membership_type, -1)), key);
2707
2718
 
2708
2719
  CREATE TABLE metaschema_modules_public.merkle_store_module (
2709
2720
  id uuid PRIMARY KEY DEFAULT uuidv7(),
2710
2721
  database_id uuid NOT NULL,
2711
2722
  schema_id uuid NOT NULL DEFAULT uuid_nil(),
2723
+ private_schema_id uuid NOT NULL DEFAULT uuid_nil(),
2712
2724
  public_schema_name text,
2725
+ private_schema_name text,
2713
2726
  object_table_id uuid NOT NULL DEFAULT uuid_nil(),
2714
2727
  store_table_id uuid NOT NULL DEFAULT uuid_nil(),
2715
2728
  commit_table_id uuid NOT NULL DEFAULT uuid_nil(),
2716
2729
  ref_table_id uuid NOT NULL DEFAULT uuid_nil(),
2717
2730
  prefix text NOT NULL DEFAULT '',
2718
2731
  api_name text,
2732
+ private_api_name text,
2719
2733
  scope_field text NOT NULL DEFAULT 'scope_id',
2720
2734
  created_at timestamptz NOT NULL DEFAULT now(),
2721
2735
  CONSTRAINT db_fkey
@@ -2726,21 +2740,25 @@ CREATE TABLE metaschema_modules_public.merkle_store_module (
2726
2740
  FOREIGN KEY(schema_id)
2727
2741
  REFERENCES metaschema_public.schema (id)
2728
2742
  ON DELETE CASCADE,
2743
+ CONSTRAINT private_schema_fkey
2744
+ FOREIGN KEY(private_schema_id)
2745
+ REFERENCES metaschema_public.schema (id)
2746
+ ON DELETE CASCADE,
2729
2747
  CONSTRAINT object_table_fkey
2730
2748
  FOREIGN KEY(object_table_id)
2731
- REFERENCES metaschema_public.table (id)
2749
+ REFERENCES metaschema_public."table" (id)
2732
2750
  ON DELETE CASCADE,
2733
2751
  CONSTRAINT store_table_fkey
2734
2752
  FOREIGN KEY(store_table_id)
2735
- REFERENCES metaschema_public.table (id)
2753
+ REFERENCES metaschema_public."table" (id)
2736
2754
  ON DELETE CASCADE,
2737
2755
  CONSTRAINT commit_table_fkey
2738
2756
  FOREIGN KEY(commit_table_id)
2739
- REFERENCES metaschema_public.table (id)
2757
+ REFERENCES metaschema_public."table" (id)
2740
2758
  ON DELETE CASCADE,
2741
2759
  CONSTRAINT ref_table_fkey
2742
2760
  FOREIGN KEY(ref_table_id)
2743
- REFERENCES metaschema_public.table (id)
2761
+ REFERENCES metaschema_public."table" (id)
2744
2762
  ON DELETE CASCADE,
2745
2763
  CONSTRAINT merkle_store_module_database_prefix_unique
2746
2764
  UNIQUE (database_id, prefix)
@@ -2748,6 +2766,8 @@ CREATE TABLE metaschema_modules_public.merkle_store_module (
2748
2766
 
2749
2767
  CREATE INDEX merkle_store_module_database_id_idx ON metaschema_modules_public.merkle_store_module (database_id);
2750
2768
 
2769
+ CREATE INDEX merkle_store_module_private_schema_id_idx ON metaschema_modules_public.merkle_store_module (private_schema_id);
2770
+
2751
2771
  CREATE TABLE metaschema_modules_public.graph_module (
2752
2772
  id uuid PRIMARY KEY DEFAULT uuidv7(),
2753
2773
  database_id uuid NOT NULL,
@@ -2786,19 +2806,19 @@ CREATE TABLE metaschema_modules_public.graph_module (
2786
2806
  ON DELETE CASCADE,
2787
2807
  CONSTRAINT graphs_table_fkey
2788
2808
  FOREIGN KEY(graphs_table_id)
2789
- REFERENCES metaschema_public.table (id)
2809
+ REFERENCES metaschema_public."table" (id)
2790
2810
  ON DELETE CASCADE,
2791
2811
  CONSTRAINT executions_table_fkey
2792
2812
  FOREIGN KEY(executions_table_id)
2793
- REFERENCES metaschema_public.table (id)
2813
+ REFERENCES metaschema_public."table" (id)
2794
2814
  ON DELETE CASCADE,
2795
2815
  CONSTRAINT outputs_table_fkey
2796
2816
  FOREIGN KEY(outputs_table_id)
2797
- REFERENCES metaschema_public.table (id)
2817
+ REFERENCES metaschema_public."table" (id)
2798
2818
  ON DELETE CASCADE,
2799
2819
  CONSTRAINT graph_module_entity_table_fkey
2800
2820
  FOREIGN KEY(entity_table_id)
2801
- REFERENCES metaschema_public.table (id)
2821
+ REFERENCES metaschema_public."table" (id)
2802
2822
  ON DELETE CASCADE,
2803
2823
  CONSTRAINT graph_module_database_merkle_unique
2804
2824
  UNIQUE (database_id, merkle_store_module_id)
@@ -2820,6 +2840,7 @@ CREATE TABLE metaschema_modules_public.namespace_module (
2820
2840
  api_name text,
2821
2841
  private_api_name text,
2822
2842
  membership_type int DEFAULT NULL,
2843
+ key text NOT NULL DEFAULT 'default',
2823
2844
  entity_table_id uuid NULL,
2824
2845
  policies jsonb NULL,
2825
2846
  provisions jsonb NULL,
@@ -2837,21 +2858,21 @@ CREATE TABLE metaschema_modules_public.namespace_module (
2837
2858
  ON DELETE CASCADE,
2838
2859
  CONSTRAINT namespace_module_namespaces_table_fkey
2839
2860
  FOREIGN KEY(namespaces_table_id)
2840
- REFERENCES metaschema_public.table (id)
2861
+ REFERENCES metaschema_public."table" (id)
2841
2862
  ON DELETE CASCADE,
2842
2863
  CONSTRAINT namespace_module_events_table_fkey
2843
2864
  FOREIGN KEY(namespace_events_table_id)
2844
- REFERENCES metaschema_public.table (id)
2865
+ REFERENCES metaschema_public."table" (id)
2845
2866
  ON DELETE CASCADE,
2846
2867
  CONSTRAINT namespace_module_entity_table_fkey
2847
2868
  FOREIGN KEY(entity_table_id)
2848
- REFERENCES metaschema_public.table (id)
2869
+ REFERENCES metaschema_public."table" (id)
2849
2870
  ON DELETE CASCADE
2850
2871
  );
2851
2872
 
2852
2873
  CREATE INDEX namespace_module_database_id_idx ON metaschema_modules_public.namespace_module (database_id);
2853
2874
 
2854
- CREATE UNIQUE INDEX namespace_module_unique_scope ON metaschema_modules_public.namespace_module (database_id, (COALESCE(membership_type, -1)));
2875
+ CREATE UNIQUE INDEX namespace_module_unique_scope ON metaschema_modules_public.namespace_module (database_id, (COALESCE(membership_type, -1)), key);
2855
2876
 
2856
2877
  CREATE TABLE metaschema_modules_public.function_module (
2857
2878
  id uuid PRIMARY KEY DEFAULT uuidv7(),
@@ -2863,12 +2884,21 @@ CREATE TABLE metaschema_modules_public.function_module (
2863
2884
  definitions_table_id uuid NOT NULL DEFAULT uuid_nil(),
2864
2885
  invocations_table_id uuid NOT NULL DEFAULT uuid_nil(),
2865
2886
  execution_logs_table_id uuid NOT NULL DEFAULT uuid_nil(),
2887
+ secret_definitions_table_id uuid NOT NULL DEFAULT uuid_nil(),
2888
+ requirements_table_id uuid NOT NULL DEFAULT uuid_nil(),
2889
+ config_definitions_table_id uuid NOT NULL DEFAULT uuid_nil(),
2890
+ config_requirements_table_id uuid NOT NULL DEFAULT uuid_nil(),
2866
2891
  definitions_table_name text NOT NULL DEFAULT 'function_definitions',
2867
2892
  invocations_table_name text NOT NULL DEFAULT 'function_invocations',
2868
2893
  execution_logs_table_name text NOT NULL DEFAULT 'function_execution_logs',
2894
+ secret_definitions_table_name text NOT NULL DEFAULT 'secret_definitions',
2895
+ requirements_table_name text NOT NULL DEFAULT 'function_secret_requirements',
2896
+ config_requirements_table_name text NOT NULL DEFAULT 'function_config_requirements',
2869
2897
  api_name text,
2870
2898
  private_api_name text,
2871
2899
  membership_type int DEFAULT NULL,
2900
+ prefix text NULL,
2901
+ key text NOT NULL DEFAULT 'default',
2872
2902
  entity_table_id uuid NULL,
2873
2903
  policies jsonb NULL,
2874
2904
  provisions jsonb NULL,
@@ -2886,22 +2916,38 @@ CREATE TABLE metaschema_modules_public.function_module (
2886
2916
  ON DELETE CASCADE,
2887
2917
  CONSTRAINT function_module_definitions_table_fkey
2888
2918
  FOREIGN KEY(definitions_table_id)
2889
- REFERENCES metaschema_public.table (id)
2919
+ REFERENCES metaschema_public."table" (id)
2890
2920
  ON DELETE CASCADE,
2891
2921
  CONSTRAINT function_module_invocations_table_fkey
2892
2922
  FOREIGN KEY(invocations_table_id)
2893
- REFERENCES metaschema_public.table (id)
2923
+ REFERENCES metaschema_public."table" (id)
2894
2924
  ON DELETE CASCADE,
2895
2925
  CONSTRAINT function_module_execution_logs_table_fkey
2896
2926
  FOREIGN KEY(execution_logs_table_id)
2897
- REFERENCES metaschema_public.table (id)
2927
+ REFERENCES metaschema_public."table" (id)
2928
+ ON DELETE CASCADE,
2929
+ CONSTRAINT function_module_secret_defs_table_fkey
2930
+ FOREIGN KEY(secret_definitions_table_id)
2931
+ REFERENCES metaschema_public."table" (id)
2932
+ ON DELETE CASCADE,
2933
+ CONSTRAINT function_module_requirements_table_fkey
2934
+ FOREIGN KEY(requirements_table_id)
2935
+ REFERENCES metaschema_public."table" (id)
2936
+ ON DELETE CASCADE,
2937
+ CONSTRAINT function_module_config_defs_table_fkey
2938
+ FOREIGN KEY(config_definitions_table_id)
2939
+ REFERENCES metaschema_public."table" (id)
2940
+ ON DELETE CASCADE,
2941
+ CONSTRAINT function_module_config_reqs_table_fkey
2942
+ FOREIGN KEY(config_requirements_table_id)
2943
+ REFERENCES metaschema_public."table" (id)
2898
2944
  ON DELETE CASCADE,
2899
2945
  CONSTRAINT function_module_entity_table_fkey
2900
2946
  FOREIGN KEY(entity_table_id)
2901
- REFERENCES metaschema_public.table (id)
2947
+ REFERENCES metaschema_public."table" (id)
2902
2948
  ON DELETE CASCADE
2903
2949
  );
2904
2950
 
2905
2951
  CREATE INDEX function_module_database_id_idx ON metaschema_modules_public.function_module (database_id);
2906
2952
 
2907
- CREATE UNIQUE INDEX function_module_unique_scope ON metaschema_modules_public.function_module (database_id, (COALESCE(membership_type, -1)));
2953
+ CREATE UNIQUE INDEX function_module_unique_scope ON metaschema_modules_public.function_module (database_id, (COALESCE(membership_type, -1)), key);