diff --git a/packages/metaschema-modules/Makefile b/packages/metaschema-modules/Makefile index f8bc992d..3e3aac65 100644 --- a/packages/metaschema-modules/Makefile +++ b/packages/metaschema-modules/Makefile @@ -1,5 +1,5 @@ EXTENSION = metaschema-modules -DATA = sql/metaschema-modules--0.26.3.sql +DATA = sql/metaschema-modules--0.26.5.sql PG_CONFIG = pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) diff --git a/packages/metaschema-modules/__tests__/__snapshots__/modules.test.ts.snap b/packages/metaschema-modules/__tests__/__snapshots__/modules.test.ts.snap index 6634a250..fb44006a 100644 --- a/packages/metaschema-modules/__tests__/__snapshots__/modules.test.ts.snap +++ b/packages/metaschema-modules/__tests__/__snapshots__/modules.test.ts.snap @@ -18,6 +18,7 @@ exports[`db_meta_modules should have all expected module tables 1`] = ` "devices_module", "emails_module", "events_module", + "function_invocation_module", "function_module", "graph_module", "hierarchy_module", @@ -57,8 +58,8 @@ exports[`db_meta_modules should have all expected module tables 1`] = ` exports[`db_meta_modules should verify all module tables exist in metaschema_modules_public schema 1`] = ` { - "moduleTablesCount": 48, - "totalTables": 55, + "moduleTablesCount": 49, + "totalTables": 56, } `; @@ -125,13 +126,13 @@ exports[`db_meta_modules should verify emails_module table structure 1`] = ` exports[`db_meta_modules should verify module table structures have database_id foreign keys 1`] = ` { - "constraintCount": 303413, + "constraintCount": 303414, } `; exports[`db_meta_modules should verify module tables have proper foreign key relationships 1`] = ` { - "constraintCount": 452625, + "constraintCount": 452630, "foreignTables": [ "database", "field", diff --git a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/function_invocation_module/table.sql b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/function_invocation_module/table.sql new file mode 100644 index 00000000..6e893ebd --- /dev/null +++ b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/function_invocation_module/table.sql @@ -0,0 +1,67 @@ +-- Deploy schemas/metaschema_modules_public/tables/function_invocation_module/table to pg + +-- requires: schemas/metaschema_modules_public/schema + +BEGIN; + +CREATE TABLE metaschema_modules_public.function_invocation_module ( + id uuid PRIMARY KEY DEFAULT uuidv7(), + database_id uuid NOT NULL, + + -- Schema references (if uuid_nil, resolved from schema name or default) + schema_id uuid NOT NULL DEFAULT uuid_nil(), + private_schema_id uuid NOT NULL DEFAULT uuid_nil(), + + -- Optional schema name overrides (used when schema IDs are not provided) + public_schema_name text, + private_schema_name text, + + -- Generated table IDs (populated by the generator) + invocations_table_id uuid NOT NULL DEFAULT uuid_nil(), + execution_logs_table_id uuid NOT NULL DEFAULT uuid_nil(), + + -- Table names (input to the generator — bare names without scope prefix). + -- The trigger prepends the scope prefix automatically. + invocations_table_name text NOT NULL DEFAULT 'function_invocations', + execution_logs_table_name text NOT NULL DEFAULT 'function_execution_logs', + + -- API routing (get-or-create: if set, schema is added to this API; if NULL, no API is added) + api_name text, + private_api_name text, + + -- Scope: determines the security level for this module instance. + scope text NOT NULL DEFAULT 'app', + + -- Table name prefix. Auto-derived from scope by the trigger when empty. + -- Override to create multiple module instances at the same scope. + prefix text NOT NULL DEFAULT '', + + -- Entity table for RLS and billing attribution. + -- When set, invocations are scoped to the entity (org, app) for billing/metering. + entity_table_id uuid NULL, + + -- Configurable security policies (NULL = use defaults based on scope). + policies jsonb NULL, + + -- Per-table provisions overrides from blueprint config. + -- Keys are table keys (invocations, execution_logs). + provisions jsonb NULL, + + -- Default permissions: permission names auto-granted to new members. + default_permissions text[] DEFAULT NULL, + + -- Constraints + CONSTRAINT function_invocation_module_db_fkey FOREIGN KEY (database_id) REFERENCES metaschema_public.database (id) ON DELETE CASCADE, + CONSTRAINT function_invocation_module_schema_fkey FOREIGN KEY (schema_id) REFERENCES metaschema_public.schema (id) ON DELETE CASCADE, + CONSTRAINT function_invocation_module_private_schema_fkey FOREIGN KEY (private_schema_id) REFERENCES metaschema_public.schema (id) ON DELETE CASCADE, + CONSTRAINT function_invocation_module_invocations_table_fkey FOREIGN KEY (invocations_table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE, + CONSTRAINT function_invocation_module_logs_table_fkey FOREIGN KEY (execution_logs_table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE, + CONSTRAINT function_invocation_module_entity_table_fkey FOREIGN KEY (entity_table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE +); + +CREATE INDEX function_invocation_module_database_id_idx ON metaschema_modules_public.function_invocation_module ( database_id ); + +-- Unique constraint: one function invocation module per database per scope per prefix. +CREATE UNIQUE INDEX function_invocation_module_unique_scope ON metaschema_modules_public.function_invocation_module ( database_id, scope, prefix ); + +COMMIT; diff --git a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/function_module/table.sql b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/function_module/table.sql index 841d5345..30f05028 100644 --- a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/function_module/table.sql +++ b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/function_module/table.sql @@ -18,15 +18,11 @@ CREATE TABLE metaschema_modules_public.function_module ( -- Generated table IDs (populated by the generator) definitions_table_id uuid NOT NULL DEFAULT uuid_nil(), - invocations_table_id uuid NOT NULL DEFAULT uuid_nil(), - execution_logs_table_id uuid NOT NULL DEFAULT uuid_nil(), secret_definitions_table_id uuid NOT NULL DEFAULT uuid_nil(), -- Table names (input to the generator — bare names without scope prefix). -- The trigger prepends the scope prefix automatically. definitions_table_name text NOT NULL DEFAULT 'function_definitions', - invocations_table_name text NOT NULL DEFAULT 'function_invocations', - execution_logs_table_name text NOT NULL DEFAULT 'function_execution_logs', secret_definitions_table_name text NOT NULL DEFAULT 'secret_definitions', -- API routing (get-or-create: if set, schema is added to this API; if NULL, no API is added) @@ -51,7 +47,7 @@ CREATE TABLE metaschema_modules_public.function_module ( policies jsonb NULL, -- Per-table provisions overrides from blueprint config. - -- Keys are table keys (definitions, invocations, execution_logs, secret_definitions). + -- Keys are table keys (definitions, secret_definitions). -- When a key is present, the module trigger skips default security for that table; -- secure_table_provision applies the custom grants/policies instead. provisions jsonb NULL, @@ -65,8 +61,6 @@ CREATE TABLE metaschema_modules_public.function_module ( CONSTRAINT function_module_schema_fkey FOREIGN KEY (schema_id) REFERENCES metaschema_public.schema (id) ON DELETE CASCADE, CONSTRAINT function_module_private_schema_fkey FOREIGN KEY (private_schema_id) REFERENCES metaschema_public.schema (id) ON DELETE CASCADE, CONSTRAINT function_module_definitions_table_fkey FOREIGN KEY (definitions_table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE, - CONSTRAINT function_module_invocations_table_fkey FOREIGN KEY (invocations_table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE, - CONSTRAINT function_module_execution_logs_table_fkey FOREIGN KEY (execution_logs_table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT function_module_secret_defs_table_fkey FOREIGN KEY (secret_definitions_table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT function_module_entity_table_fkey FOREIGN KEY (entity_table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); diff --git a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/memberships_module/table.sql b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/memberships_module/table.sql index fa07cdfb..fa9c6eee 100644 --- a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/memberships_module/table.sql +++ b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/memberships_module/table.sql @@ -64,8 +64,10 @@ CREATE TABLE metaschema_modules_public.memberships_module ( member_profiles_table_id uuid NULL, - -- - + -- Audit tables for permission defaults (created by memberships_module when has_permissions=true) + permission_default_permissions_table_id uuid NULL, + permission_default_grants_table_id uuid NULL, + -- API routing (configurable per-module) api_name text DEFAULT 'admin', private_api_name text DEFAULT NULL, diff --git a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/merkle_store_module/table.sql b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/merkle_store_module/table.sql index 744c5f66..e3dda66c 100644 --- a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/merkle_store_module/table.sql +++ b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/merkle_store_module/table.sql @@ -34,6 +34,11 @@ CREATE TABLE metaschema_modules_public.merkle_store_module ( -- RLS through metaschema_public.database ownership. scope text NOT NULL DEFAULT 'app', + -- Function name prefix override: NULL (default) inherits from `prefix`; + -- '' (empty string) generates unprefixed function names (e.g., get_all instead of function_graph_get_all); + -- any other value is used as-is. Tables always keep their prefix regardless of this setting. + function_prefix text DEFAULT NULL, + -- Timestamps created_at timestamptz NOT NULL DEFAULT now(), diff --git a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/notifications_module/table.sql b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/notifications_module/table.sql index 0acd075b..c0145591 100644 --- a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/notifications_module/table.sql +++ b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/notifications_module/table.sql @@ -19,6 +19,7 @@ CREATE TABLE metaschema_modules_public.notifications_module ( preferences_table_id uuid, channels_table_id uuid, delivery_log_table_id uuid, + suppressions_table_id uuid, owner_table_id uuid NOT NULL DEFAULT uuid_nil(), @@ -51,6 +52,7 @@ CREATE TABLE metaschema_modules_public.notifications_module ( CONSTRAINT preferences_table_fkey FOREIGN KEY (preferences_table_id) REFERENCES metaschema_public.table (id) ON DELETE SET NULL, CONSTRAINT channels_table_fkey FOREIGN KEY (channels_table_id) REFERENCES metaschema_public.table (id) ON DELETE SET NULL, CONSTRAINT delivery_log_table_fkey FOREIGN KEY (delivery_log_table_id) REFERENCES metaschema_public.table (id) ON DELETE SET NULL, + CONSTRAINT suppressions_table_fkey FOREIGN KEY (suppressions_table_id) REFERENCES metaschema_public.table (id) ON DELETE SET NULL, CONSTRAINT owner_table_fkey FOREIGN KEY (owner_table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT user_settings_table_fkey FOREIGN KEY (user_settings_table_id) REFERENCES metaschema_public.table (id) ON DELETE SET NULL, CONSTRAINT organization_settings_table_fkey FOREIGN KEY (organization_settings_table_id) REFERENCES metaschema_public.table (id) ON DELETE SET NULL, @@ -65,6 +67,7 @@ COMMENT ON CONSTRAINT read_state_table_fkey ON metaschema_modules_public.notific COMMENT ON CONSTRAINT preferences_table_fkey ON metaschema_modules_public.notifications_module IS E'@fieldName preferencesTableByPreferencesTableId\n@omit manyToMany'; COMMENT ON CONSTRAINT channels_table_fkey ON metaschema_modules_public.notifications_module IS E'@fieldName channelsTableByChannelsTableId\n@omit manyToMany'; COMMENT ON CONSTRAINT delivery_log_table_fkey ON metaschema_modules_public.notifications_module IS E'@fieldName deliveryLogTableByDeliveryLogTableId\n@omit manyToMany'; +COMMENT ON CONSTRAINT suppressions_table_fkey ON metaschema_modules_public.notifications_module IS E'@fieldName suppressionsTableBySuppressionsTableId'; COMMENT ON CONSTRAINT owner_table_fkey ON metaschema_modules_public.notifications_module IS E'@omit manyToMany'; COMMENT ON CONSTRAINT user_settings_table_fkey ON metaschema_modules_public.notifications_module IS E'@fieldName userSettingsTableByUserSettingsTableId\n@omit manyToMany'; COMMENT ON CONSTRAINT organization_settings_table_fkey ON metaschema_modules_public.notifications_module IS E'@fieldName organizationSettingsTableByOrganizationSettingsTableId\n@omit manyToMany'; diff --git a/packages/metaschema-modules/metaschema-modules.control b/packages/metaschema-modules/metaschema-modules.control index f7dd5703..37d335ec 100644 --- a/packages/metaschema-modules/metaschema-modules.control +++ b/packages/metaschema-modules/metaschema-modules.control @@ -1,6 +1,6 @@ # metaschema-modules extension comment = 'metaschema-modules extension' -default_version = '0.26.3' +default_version = '0.26.5' module_pathname = '$libdir/metaschema-modules' requires = 'plpgsql,uuid-ossp,metaschema-schema,services,pgpm-verify' relocatable = false diff --git a/packages/metaschema-modules/pgpm.plan b/packages/metaschema-modules/pgpm.plan index ba706dd3..7ca82d0d 100644 --- a/packages/metaschema-modules/pgpm.plan +++ b/packages/metaschema-modules/pgpm.plan @@ -60,6 +60,7 @@ schemas/metaschema_modules_public/tables/merkle_store_module/table [schemas/meta schemas/metaschema_modules_public/tables/graph_module/table [schemas/metaschema_modules_public/schema schemas/metaschema_modules_public/tables/merkle_store_module/table] 2026-05-21T01:00:00Z devin # add graph_module config table for FBP graph utilities on top of merkle store schemas/metaschema_modules_public/tables/namespace_module/table [schemas/metaschema_modules_public/schema] 2026-05-21T02:00:00Z devin # add namespace_module config table for entity-aware namespace provisioning schemas/metaschema_modules_public/tables/function_module/table [schemas/metaschema_modules_public/schema] 2026-05-21T03:00:00Z devin # add function_module config table for entity-aware function definitions +schemas/metaschema_modules_public/tables/function_invocation_module/table [schemas/metaschema_modules_public/schema] 2026-06-08T00:00:00Z devin # add function_invocation_module config table for entity-scoped invocations and execution logs schemas/metaschema_modules_public/tables/config_secrets_module/table [schemas/metaschema_modules_public/schema] 2026-05-29T00:00:00Z devin # add entity-aware config_secrets_module (replaces config_secrets_user_module + config_secrets_org_module) schemas/metaschema_modules_public/tables/user_credentials_module/table [schemas/metaschema_modules_public/schema] 2026-05-30T00:00:00Z devin # add user_credentials_module for per-user bcrypt credential store (split from config_secrets_module) schemas/metaschema_modules_public/tables/user_settings_module/table [schemas/metaschema_modules_public/schema] 2026-05-28T00:00:00Z devin # add user_settings_module for extensible per-user preferences (1:1 with users) diff --git a/packages/metaschema-modules/revert/schemas/metaschema_modules_public/tables/function_invocation_module/table.sql b/packages/metaschema-modules/revert/schemas/metaschema_modules_public/tables/function_invocation_module/table.sql new file mode 100644 index 00000000..7a634a78 --- /dev/null +++ b/packages/metaschema-modules/revert/schemas/metaschema_modules_public/tables/function_invocation_module/table.sql @@ -0,0 +1,7 @@ +-- Revert schemas/metaschema_modules_public/tables/function_invocation_module/table from pg + +BEGIN; + +DROP TABLE IF EXISTS metaschema_modules_public.function_invocation_module; + +COMMIT; diff --git a/packages/metaschema-modules/sql/metaschema-modules--0.26.3.sql b/packages/metaschema-modules/sql/metaschema-modules--0.26.5.sql similarity index 93% rename from packages/metaschema-modules/sql/metaschema-modules--0.26.3.sql rename to packages/metaschema-modules/sql/metaschema-modules--0.26.5.sql index 91453238..6a0eadb9 100644 --- a/packages/metaschema-modules/sql/metaschema-modules--0.26.3.sql +++ b/packages/metaschema-modules/sql/metaschema-modules--0.26.5.sql @@ -39,11 +39,11 @@ CREATE TABLE metaschema_modules_public.connected_accounts_module ( ON DELETE CASCADE, CONSTRAINT table_fkey FOREIGN KEY(table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT owner_table_fkey FOREIGN KEY(owner_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT schema_fkey FOREIGN KEY(schema_id) @@ -74,11 +74,11 @@ CREATE TABLE metaschema_modules_public.crypto_addresses_module ( ON DELETE CASCADE, CONSTRAINT table_fkey FOREIGN KEY(table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT owner_table_fkey FOREIGN KEY(owner_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT schema_fkey FOREIGN KEY(schema_id) @@ -113,19 +113,19 @@ CREATE TABLE metaschema_modules_public.crypto_auth_module ( ON DELETE CASCADE, CONSTRAINT secrets_table_fkey FOREIGN KEY(secrets_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT users_table_fkey FOREIGN KEY(users_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT sessions_table_fkey FOREIGN KEY(sessions_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT session_credentials_table_fkey FOREIGN KEY(session_credentials_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT schema_fkey FOREIGN KEY(schema_id) @@ -165,11 +165,11 @@ CREATE TABLE metaschema_modules_public.denormalized_table_field ( ON DELETE CASCADE, CONSTRAINT table_fkey FOREIGN KEY(table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT ref_table_fkey FOREIGN KEY(ref_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT field_fkey FOREIGN KEY(field_id) @@ -199,11 +199,11 @@ CREATE TABLE metaschema_modules_public.emails_module ( ON DELETE CASCADE, CONSTRAINT table_fkey FOREIGN KEY(table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT owner_table_fkey FOREIGN KEY(owner_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT schema_fkey FOREIGN KEY(schema_id) @@ -236,11 +236,11 @@ CREATE TABLE metaschema_modules_public.config_secrets_user_module ( ON DELETE CASCADE, CONSTRAINT table_fkey FOREIGN KEY(table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT config_defs_table_fkey FOREIGN KEY(config_definitions_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -269,23 +269,23 @@ CREATE TABLE metaschema_modules_public.invites_module ( ON DELETE CASCADE, CONSTRAINT invites_table_fkey FOREIGN KEY(invites_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT emails_table_fkey FOREIGN KEY(emails_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT users_table_fkey FOREIGN KEY(users_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT entity_table_fkey FOREIGN KEY(entity_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT claimed_invites_table_fkey FOREIGN KEY(claimed_invites_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT schema_fkey FOREIGN KEY(schema_id) @@ -334,7 +334,7 @@ CREATE TABLE metaschema_modules_public.events_module ( tg_check_achievements text NOT NULL DEFAULT '', grant_achievement text NOT NULL DEFAULT '', tg_achievement_reward text NOT NULL DEFAULT '', - interval text NOT NULL DEFAULT '1 month', + "interval" text NOT NULL DEFAULT '1 month', retention text DEFAULT '12 months', premake int NOT NULL DEFAULT 2, scope text NOT NULL DEFAULT 'app', @@ -358,39 +358,39 @@ CREATE TABLE metaschema_modules_public.events_module ( ON DELETE CASCADE, CONSTRAINT events_table_fkey FOREIGN KEY(events_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT event_aggregates_table_fkey FOREIGN KEY(event_aggregates_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT event_types_table_fkey FOREIGN KEY(event_types_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT levels_table_fkey FOREIGN KEY(levels_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT level_requirements_table_fkey FOREIGN KEY(level_requirements_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT level_grants_table_fkey FOREIGN KEY(level_grants_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT achievement_rewards_table_fkey FOREIGN KEY(achievement_rewards_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT entity_table_fkey FOREIGN KEY(entity_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT actor_table_fkey FOREIGN KEY(actor_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -445,59 +445,59 @@ CREATE TABLE metaschema_modules_public.limits_module ( ON DELETE CASCADE, CONSTRAINT table_fkey FOREIGN KEY(table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT default_table_fkey FOREIGN KEY(default_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT entity_table_fkey FOREIGN KEY(entity_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT actor_table_fkey FOREIGN KEY(actor_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT aggregate_table_fkey FOREIGN KEY(aggregate_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT limit_credits_table_fkey FOREIGN KEY(limit_credits_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT events_table_fkey FOREIGN KEY(events_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT credit_codes_table_fkey FOREIGN KEY(credit_codes_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT credit_code_items_table_fkey FOREIGN KEY(credit_code_items_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT credit_redemptions_table_fkey FOREIGN KEY(credit_redemptions_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT limit_caps_table_fkey FOREIGN KEY(limit_caps_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT limit_caps_defaults_table_fkey FOREIGN KEY(limit_caps_defaults_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT limit_warnings_table_fkey FOREIGN KEY(limit_warnings_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT limit_warning_state_table_fkey FOREIGN KEY(limit_warning_state_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -519,7 +519,7 @@ CREATE TABLE metaschema_modules_public.membership_types_module ( ON DELETE CASCADE, CONSTRAINT table_fkey FOREIGN KEY(table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -561,6 +561,8 @@ CREATE TABLE metaschema_modules_public.memberships_module ( entity_ids_by_perm text NULL, entity_ids_function text NULL, member_profiles_table_id uuid NULL, + permission_default_permissions_table_id uuid NULL, + permission_default_grants_table_id uuid NULL, api_name text DEFAULT 'admin', private_api_name text DEFAULT NULL, CONSTRAINT db_fkey @@ -577,31 +579,31 @@ CREATE TABLE metaschema_modules_public.memberships_module ( ON DELETE CASCADE, CONSTRAINT memberships_table_fkey FOREIGN KEY(memberships_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT membership_defaults_table_fkey FOREIGN KEY(membership_defaults_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT membership_settings_table_fkey FOREIGN KEY(membership_settings_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT members_table_fkey FOREIGN KEY(members_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT grants_table_fkey FOREIGN KEY(grants_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT sprt_table_fkey FOREIGN KEY(sprt_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT entity_table_fkey FOREIGN KEY(entity_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT entity_table_owner_fkey FOREIGN KEY(entity_table_owner_id) @@ -609,23 +611,23 @@ CREATE TABLE metaschema_modules_public.memberships_module ( ON DELETE CASCADE, CONSTRAINT actor_table_fkey FOREIGN KEY(actor_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT limits_table_fkey FOREIGN KEY(limits_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT default_limits_table_fkey FOREIGN KEY(default_limits_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT permissions_table_fkey FOREIGN KEY(permissions_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT default_permissions_table_fkey FOREIGN KEY(default_permissions_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT memberships_module_unique UNIQUE (database_id, scope, prefix) @@ -667,19 +669,19 @@ CREATE TABLE metaschema_modules_public.permissions_module ( ON DELETE CASCADE, CONSTRAINT table_fkey FOREIGN KEY(table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT default_table_fkey FOREIGN KEY(default_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT entity_table_fkey FOREIGN KEY(entity_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT actor_table_fkey FOREIGN KEY(actor_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -701,11 +703,11 @@ CREATE TABLE metaschema_modules_public.phone_numbers_module ( ON DELETE CASCADE, CONSTRAINT table_fkey FOREIGN KEY(table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT owner_table_fkey FOREIGN KEY(owner_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT schema_fkey FOREIGN KEY(schema_id) @@ -756,39 +758,39 @@ CREATE TABLE metaschema_modules_public.profiles_module ( ON DELETE CASCADE, CONSTRAINT table_fkey FOREIGN KEY(table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT profile_permissions_table_fkey FOREIGN KEY(profile_permissions_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT profile_grants_table_fkey FOREIGN KEY(profile_grants_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT profile_definition_grants_table_fkey FOREIGN KEY(profile_definition_grants_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT profile_templates_table_fkey FOREIGN KEY(profile_templates_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT entity_table_fkey FOREIGN KEY(entity_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT actor_table_fkey FOREIGN KEY(actor_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT permissions_table_fkey FOREIGN KEY(permissions_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT memberships_table_fkey FOREIGN KEY(memberships_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT profiles_module_unique UNIQUE (database_id, scope, prefix) @@ -816,15 +818,15 @@ CREATE TABLE metaschema_modules_public.rls_module ( ON DELETE CASCADE, CONSTRAINT session_credentials_table_fkey FOREIGN KEY(session_credentials_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT sessions_table_fkey FOREIGN KEY(sessions_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT users_table_fkey FOREIGN KEY(users_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT schema_fkey FOREIGN KEY(schema_id) @@ -864,7 +866,7 @@ CREATE TABLE metaschema_modules_public.user_state_module ( ON DELETE CASCADE, CONSTRAINT table_fkey FOREIGN KEY(table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -892,19 +894,19 @@ CREATE TABLE metaschema_modules_public.sessions_module ( ON DELETE CASCADE, CONSTRAINT sessions_table_fkey FOREIGN KEY(sessions_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT session_credentials_table_fkey FOREIGN KEY(session_credentials_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT auth_settings_table_fkey FOREIGN KEY(auth_settings_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT users_table_fkey FOREIGN KEY(users_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -955,27 +957,27 @@ CREATE TABLE metaschema_modules_public.user_auth_module ( ON DELETE CASCADE, CONSTRAINT email_table_fkey FOREIGN KEY(emails_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT users_table_fkey FOREIGN KEY(users_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT secrets_table_fkey FOREIGN KEY(secrets_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT encrypted_table_fkey FOREIGN KEY(encrypted_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT sessions_table_fkey FOREIGN KEY(sessions_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT session_credentials_table_fkey FOREIGN KEY(session_credentials_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -1013,11 +1015,11 @@ CREATE TABLE metaschema_modules_public.users_module ( ON DELETE CASCADE, CONSTRAINT table_fkey FOREIGN KEY(table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT type_table_fkey FOREIGN KEY(type_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -1060,23 +1062,23 @@ CREATE TABLE metaschema_modules_public.hierarchy_module ( ON DELETE CASCADE, CONSTRAINT chart_edges_table_fkey FOREIGN KEY(chart_edges_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT hierarchy_sprt_table_fkey FOREIGN KEY(hierarchy_sprt_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT chart_edge_grants_table_fkey FOREIGN KEY(chart_edge_grants_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT entity_table_fkey FOREIGN KEY(entity_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT users_table_fkey FOREIGN KEY(users_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT hierarchy_module_database_unique UNIQUE (database_id) @@ -1102,7 +1104,7 @@ CREATE TABLE metaschema_modules_public.secure_table_provision ( ON DELETE CASCADE, CONSTRAINT table_fkey FOREIGN KEY(table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT schema_fkey FOREIGN KEY(schema_id) @@ -1169,11 +1171,11 @@ CREATE TABLE metaschema_modules_public.relation_provision ( ON DELETE CASCADE, CONSTRAINT source_table_fkey FOREIGN KEY(source_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT target_table_fkey FOREIGN KEY(target_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -1538,23 +1540,23 @@ CREATE TABLE metaschema_modules_public.storage_module ( ON DELETE CASCADE, CONSTRAINT buckets_table_fkey FOREIGN KEY(buckets_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT files_table_fkey FOREIGN KEY(files_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT entity_table_fkey FOREIGN KEY(entity_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT path_shares_table_fkey FOREIGN KEY(path_shares_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT file_events_table_fkey FOREIGN KEY(file_events_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -1834,15 +1836,15 @@ CREATE TABLE metaschema_modules_public.rate_limits_module ( ON DELETE CASCADE, CONSTRAINT rate_limit_settings_table_fkey FOREIGN KEY(rate_limit_settings_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT ip_rate_limits_table_fkey FOREIGN KEY(ip_rate_limits_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT rate_limits_table_fkey FOREIGN KEY(rate_limits_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT rate_limits_module_database_id_uniq UNIQUE (database_id) @@ -1874,11 +1876,11 @@ CREATE TABLE metaschema_modules_public.devices_module ( ON DELETE CASCADE, CONSTRAINT user_devices_table_fkey FOREIGN KEY(user_devices_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT device_settings_table_fkey FOREIGN KEY(device_settings_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT devices_module_database_id_uniq UNIQUE (database_id) @@ -1907,11 +1909,11 @@ CREATE TABLE metaschema_modules_public.session_secrets_module ( ON DELETE CASCADE, CONSTRAINT table_fkey FOREIGN KEY(table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT sessions_table_fkey FOREIGN KEY(sessions_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -1943,11 +1945,11 @@ CREATE TABLE metaschema_modules_public.webauthn_credentials_module ( ON DELETE CASCADE, CONSTRAINT table_fkey FOREIGN KEY(table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT owner_table_fkey FOREIGN KEY(owner_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT schema_fkey FOREIGN KEY(schema_id) @@ -1992,27 +1994,27 @@ CREATE TABLE metaschema_modules_public.webauthn_auth_module ( ON DELETE CASCADE, CONSTRAINT users_table_fkey FOREIGN KEY(users_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT credentials_table_fkey FOREIGN KEY(credentials_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT sessions_table_fkey FOREIGN KEY(sessions_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT session_credentials_table_fkey FOREIGN KEY(session_credentials_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT session_secrets_table_fkey FOREIGN KEY(session_secrets_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT auth_settings_table_fkey FOREIGN KEY(auth_settings_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -2036,7 +2038,7 @@ CREATE TABLE metaschema_modules_public.identity_providers_module ( ON DELETE CASCADE, CONSTRAINT table_fkey FOREIGN KEY(table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT schema_fkey FOREIGN KEY(schema_id) @@ -2048,7 +2050,7 @@ CREATE TABLE metaschema_modules_public.identity_providers_module ( ON DELETE CASCADE, CONSTRAINT entity_table_fkey FOREIGN KEY(entity_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -2085,6 +2087,7 @@ CREATE TABLE metaschema_modules_public.notifications_module ( preferences_table_id uuid, channels_table_id uuid, delivery_log_table_id uuid, + suppressions_table_id uuid, owner_table_id uuid NOT NULL DEFAULT uuid_nil(), user_settings_table_id uuid, organization_settings_table_id uuid, @@ -2102,35 +2105,39 @@ CREATE TABLE metaschema_modules_public.notifications_module ( ON DELETE CASCADE, CONSTRAINT notifications_table_fkey FOREIGN KEY(notifications_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT read_state_table_fkey FOREIGN KEY(read_state_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT preferences_table_fkey FOREIGN KEY(preferences_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE SET NULL, CONSTRAINT channels_table_fkey FOREIGN KEY(channels_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE SET NULL, CONSTRAINT delivery_log_table_fkey FOREIGN KEY(delivery_log_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) + ON DELETE SET NULL, + CONSTRAINT suppressions_table_fkey + FOREIGN KEY(suppressions_table_id) + REFERENCES metaschema_public.table (id) ON DELETE SET NULL, CONSTRAINT owner_table_fkey FOREIGN KEY(owner_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT user_settings_table_fkey FOREIGN KEY(user_settings_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE SET NULL, CONSTRAINT organization_settings_table_fkey FOREIGN KEY(organization_settings_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE SET NULL, CONSTRAINT schema_fkey FOREIGN KEY(schema_id) @@ -2161,6 +2168,8 @@ COMMENT ON CONSTRAINT channels_table_fkey ON metaschema_modules_public.notificat COMMENT ON CONSTRAINT delivery_log_table_fkey ON metaschema_modules_public.notifications_module IS '@fieldName deliveryLogTableByDeliveryLogTableId @omit manyToMany'; +COMMENT ON CONSTRAINT suppressions_table_fkey ON metaschema_modules_public.notifications_module IS '@fieldName suppressionsTableBySuppressionsTableId'; + COMMENT ON CONSTRAINT owner_table_fkey ON metaschema_modules_public.notifications_module IS '@omit manyToMany'; COMMENT ON CONSTRAINT user_settings_table_fkey ON metaschema_modules_public.notifications_module IS '@fieldName userSettingsTableByUserSettingsTableId @@ -2207,27 +2216,27 @@ CREATE TABLE metaschema_modules_public.plans_module ( ON DELETE CASCADE, CONSTRAINT plans_table_fkey FOREIGN KEY(plans_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT plan_limits_table_fkey FOREIGN KEY(plan_limits_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT plan_pricing_table_fkey FOREIGN KEY(plan_pricing_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT plan_overrides_table_fkey FOREIGN KEY(plan_overrides_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT plan_meter_limits_table_fkey FOREIGN KEY(plan_meter_limits_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT plan_caps_table_fkey FOREIGN KEY(plan_caps_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT plans_module_database_id_unique UNIQUE (database_id) @@ -2273,31 +2282,31 @@ CREATE TABLE metaschema_modules_public.billing_module ( ON DELETE CASCADE, CONSTRAINT meters_table_fkey FOREIGN KEY(meters_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT plan_subscriptions_table_fkey FOREIGN KEY(plan_subscriptions_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT ledger_table_fkey FOREIGN KEY(ledger_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT balances_table_fkey FOREIGN KEY(balances_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT meter_credits_table_fkey FOREIGN KEY(meter_credits_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT meter_sources_table_fkey FOREIGN KEY(meter_sources_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT meter_defaults_table_fkey FOREIGN KEY(meter_defaults_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT billing_module_database_id_unique UNIQUE (database_id) @@ -2342,35 +2351,35 @@ CREATE TABLE metaschema_modules_public.billing_provider_module ( ON DELETE CASCADE, CONSTRAINT billing_customers_table_fkey FOREIGN KEY(billing_customers_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT billing_products_table_fkey FOREIGN KEY(billing_products_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT billing_prices_table_fkey FOREIGN KEY(billing_prices_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT billing_subscriptions_table_fkey FOREIGN KEY(billing_subscriptions_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT billing_webhook_events_table_fkey FOREIGN KEY(billing_webhook_events_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT products_table_fkey FOREIGN KEY(products_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE SET NULL, CONSTRAINT prices_table_fkey FOREIGN KEY(prices_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE SET NULL, CONSTRAINT subscriptions_table_fkey FOREIGN KEY(subscriptions_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE SET NULL, CONSTRAINT billing_provider_module_database_id_unique UNIQUE (database_id) @@ -2389,7 +2398,7 @@ CREATE TABLE metaschema_modules_public.realtime_module ( source_registry_table_id uuid NOT NULL DEFAULT uuid_nil(), retention_hours int NOT NULL DEFAULT 168, premake int NOT NULL DEFAULT 7, - interval text NOT NULL DEFAULT '1 day', + "interval" text NOT NULL DEFAULT '1 day', notify_channel text NULL, api_name text DEFAULT 'realtime', private_api_name text DEFAULT NULL, @@ -2411,15 +2420,15 @@ CREATE TABLE metaschema_modules_public.realtime_module ( ON DELETE CASCADE, CONSTRAINT change_log_table_fkey FOREIGN KEY(change_log_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT listener_node_table_fkey FOREIGN KEY(listener_node_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT source_registry_table_fkey FOREIGN KEY(source_registry_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -2469,15 +2478,15 @@ CREATE TABLE metaschema_modules_public.rate_limit_meters_module ( ON DELETE CASCADE, CONSTRAINT rate_limit_state_table_fkey FOREIGN KEY(rate_limit_state_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT rate_limit_overrides_table_fkey FOREIGN KEY(rate_limit_overrides_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT rate_window_limits_table_fkey FOREIGN KEY(rate_window_limits_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT rate_limit_meters_module_database_id_unique UNIQUE (database_id) @@ -2509,7 +2518,7 @@ CREATE TABLE metaschema_modules_public.config_secrets_org_module ( ON DELETE CASCADE, CONSTRAINT table_fkey FOREIGN KEY(table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -2530,7 +2539,7 @@ CREATE TABLE metaschema_modules_public.inference_log_module ( inference_log_table_name text NOT NULL DEFAULT '', usage_daily_table_id uuid NOT NULL DEFAULT uuid_nil(), usage_daily_table_name text NOT NULL DEFAULT '', - interval text NOT NULL DEFAULT '1 month', + "interval" text NOT NULL DEFAULT '1 month', retention text NOT NULL DEFAULT '12 months', premake int NOT NULL DEFAULT 2, scope text NOT NULL DEFAULT 'app', @@ -2553,11 +2562,11 @@ CREATE TABLE metaschema_modules_public.inference_log_module ( ON DELETE CASCADE, CONSTRAINT inference_log_table_fkey FOREIGN KEY(inference_log_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT usage_daily_table_fkey FOREIGN KEY(usage_daily_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT inference_log_module_database_id_prefix_unique UNIQUE NULLS NOT DISTINCT (database_id, prefix) @@ -2574,7 +2583,7 @@ CREATE TABLE metaschema_modules_public.compute_log_module ( compute_log_table_name text NOT NULL DEFAULT '', usage_daily_table_id uuid NOT NULL DEFAULT uuid_nil(), usage_daily_table_name text NOT NULL DEFAULT '', - interval text NOT NULL DEFAULT '1 month', + "interval" text NOT NULL DEFAULT '1 month', retention text NOT NULL DEFAULT '12 months', premake int NOT NULL DEFAULT 2, scope text NOT NULL DEFAULT 'app', @@ -2597,11 +2606,11 @@ CREATE TABLE metaschema_modules_public.compute_log_module ( ON DELETE CASCADE, CONSTRAINT compute_log_table_fkey FOREIGN KEY(compute_log_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT usage_daily_table_fkey FOREIGN KEY(usage_daily_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT compute_log_module_database_id_prefix_unique UNIQUE NULLS NOT DISTINCT (database_id, prefix) @@ -2618,7 +2627,7 @@ CREATE TABLE metaschema_modules_public.transfer_log_module ( transfer_log_table_name text NOT NULL DEFAULT '', usage_daily_table_id uuid NOT NULL DEFAULT uuid_nil(), usage_daily_table_name text NOT NULL DEFAULT '', - interval text NOT NULL DEFAULT '1 month', + "interval" text NOT NULL DEFAULT '1 month', retention text NOT NULL DEFAULT '12 months', premake int NOT NULL DEFAULT 2, scope text NOT NULL DEFAULT 'app', @@ -2641,11 +2650,11 @@ CREATE TABLE metaschema_modules_public.transfer_log_module ( ON DELETE CASCADE, CONSTRAINT transfer_log_table_fkey FOREIGN KEY(transfer_log_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT usage_daily_table_fkey FOREIGN KEY(usage_daily_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT transfer_log_module_database_id_prefix_unique UNIQUE NULLS NOT DISTINCT (database_id, prefix) @@ -2662,7 +2671,7 @@ CREATE TABLE metaschema_modules_public.storage_log_module ( storage_log_table_name text NOT NULL DEFAULT '', usage_daily_table_id uuid NOT NULL DEFAULT uuid_nil(), usage_daily_table_name text NOT NULL DEFAULT '', - interval text NOT NULL DEFAULT '1 month', + "interval" text NOT NULL DEFAULT '1 month', retention text NOT NULL DEFAULT '12 months', premake int NOT NULL DEFAULT 2, scope text NOT NULL DEFAULT 'app', @@ -2685,11 +2694,11 @@ CREATE TABLE metaschema_modules_public.storage_log_module ( ON DELETE CASCADE, CONSTRAINT storage_log_table_fkey FOREIGN KEY(storage_log_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT usage_daily_table_fkey FOREIGN KEY(usage_daily_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT storage_log_module_database_id_prefix_unique UNIQUE NULLS NOT DISTINCT (database_id, prefix) @@ -2710,7 +2719,7 @@ CREATE TABLE metaschema_modules_public.db_usage_module ( query_stats_log_table_name text NOT NULL DEFAULT '', query_stats_daily_table_id uuid NOT NULL DEFAULT uuid_nil(), query_stats_daily_table_name text NOT NULL DEFAULT '', - interval text NOT NULL DEFAULT '1 month', + "interval" text NOT NULL DEFAULT '1 month', retention text NOT NULL DEFAULT '12 months', premake int NOT NULL DEFAULT 2, scope text NOT NULL DEFAULT 'app', @@ -2732,19 +2741,19 @@ CREATE TABLE metaschema_modules_public.db_usage_module ( ON DELETE CASCADE, CONSTRAINT table_stats_log_table_fkey FOREIGN KEY(table_stats_log_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT table_stats_daily_table_fkey FOREIGN KEY(table_stats_daily_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT query_stats_log_table_fkey FOREIGN KEY(query_stats_log_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT query_stats_daily_table_fkey FOREIGN KEY(query_stats_daily_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT db_usage_module_database_id_prefix_unique UNIQUE NULLS NOT DISTINCT (database_id, prefix) @@ -2800,39 +2809,39 @@ CREATE TABLE metaschema_modules_public.agent_module ( ON DELETE CASCADE, CONSTRAINT agent_module_thread_table_fkey FOREIGN KEY(thread_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT agent_module_message_table_fkey FOREIGN KEY(message_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT agent_module_task_table_fkey FOREIGN KEY(task_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT agent_module_prompts_table_fkey FOREIGN KEY(prompts_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT agent_module_plan_table_fkey FOREIGN KEY(plan_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT agent_module_agent_table_fkey FOREIGN KEY(agent_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT agent_module_persona_table_fkey FOREIGN KEY(persona_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT agent_module_resource_table_fkey FOREIGN KEY(resource_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT agent_module_entity_table_fkey FOREIGN KEY(entity_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -2855,6 +2864,7 @@ CREATE TABLE metaschema_modules_public.merkle_store_module ( api_name text, private_api_name text, scope text NOT NULL DEFAULT 'app', + function_prefix text DEFAULT NULL, created_at timestamptz NOT NULL DEFAULT now(), CONSTRAINT db_fkey FOREIGN KEY(database_id) @@ -2870,19 +2880,19 @@ CREATE TABLE metaschema_modules_public.merkle_store_module ( ON DELETE CASCADE, CONSTRAINT object_table_fkey FOREIGN KEY(object_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT store_table_fkey FOREIGN KEY(store_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT commit_table_fkey FOREIGN KEY(commit_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT ref_table_fkey FOREIGN KEY(ref_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT merkle_store_module_database_prefix_unique UNIQUE (database_id, prefix) @@ -2930,19 +2940,19 @@ CREATE TABLE metaschema_modules_public.graph_module ( ON DELETE CASCADE, CONSTRAINT graphs_table_fkey FOREIGN KEY(graphs_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT executions_table_fkey FOREIGN KEY(executions_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT outputs_table_fkey FOREIGN KEY(outputs_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT graph_module_entity_table_fkey FOREIGN KEY(entity_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT graph_module_database_merkle_unique UNIQUE (database_id, merkle_store_module_id) @@ -2983,15 +2993,15 @@ CREATE TABLE metaschema_modules_public.namespace_module ( ON DELETE CASCADE, CONSTRAINT namespace_module_namespaces_table_fkey FOREIGN KEY(namespaces_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT namespace_module_events_table_fkey FOREIGN KEY(namespace_events_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT namespace_module_entity_table_fkey FOREIGN KEY(entity_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -3007,12 +3017,8 @@ CREATE TABLE metaschema_modules_public.function_module ( public_schema_name text, private_schema_name text, definitions_table_id uuid NOT NULL DEFAULT uuid_nil(), - invocations_table_id uuid NOT NULL DEFAULT uuid_nil(), - execution_logs_table_id uuid NOT NULL DEFAULT uuid_nil(), secret_definitions_table_id uuid NOT NULL DEFAULT uuid_nil(), definitions_table_name text NOT NULL DEFAULT 'function_definitions', - invocations_table_name text NOT NULL DEFAULT 'function_invocations', - execution_logs_table_name text NOT NULL DEFAULT 'function_execution_logs', secret_definitions_table_name text NOT NULL DEFAULT 'secret_definitions', api_name text, private_api_name text, @@ -3036,23 +3042,15 @@ CREATE TABLE metaschema_modules_public.function_module ( ON DELETE CASCADE, CONSTRAINT function_module_definitions_table_fkey FOREIGN KEY(definitions_table_id) - REFERENCES metaschema_public."table" (id) - ON DELETE CASCADE, - CONSTRAINT function_module_invocations_table_fkey - FOREIGN KEY(invocations_table_id) - REFERENCES metaschema_public."table" (id) - ON DELETE CASCADE, - CONSTRAINT function_module_execution_logs_table_fkey - FOREIGN KEY(execution_logs_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT function_module_secret_defs_table_fkey FOREIGN KEY(secret_definitions_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT function_module_entity_table_fkey FOREIGN KEY(entity_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -3060,6 +3058,55 @@ CREATE INDEX function_module_database_id_idx ON metaschema_modules_public.functi CREATE UNIQUE INDEX function_module_unique_scope ON metaschema_modules_public.function_module (database_id, scope, prefix); +CREATE TABLE metaschema_modules_public.function_invocation_module ( + id uuid PRIMARY KEY DEFAULT uuidv7(), + database_id uuid NOT NULL, + schema_id uuid NOT NULL DEFAULT uuid_nil(), + private_schema_id uuid NOT NULL DEFAULT uuid_nil(), + public_schema_name text, + private_schema_name text, + invocations_table_id uuid NOT NULL DEFAULT uuid_nil(), + execution_logs_table_id uuid NOT NULL DEFAULT uuid_nil(), + invocations_table_name text NOT NULL DEFAULT 'function_invocations', + execution_logs_table_name text NOT NULL DEFAULT 'function_execution_logs', + api_name text, + private_api_name text, + scope text NOT NULL DEFAULT 'app', + prefix text NOT NULL DEFAULT '', + entity_table_id uuid NULL, + policies jsonb NULL, + provisions jsonb NULL, + default_permissions text[] DEFAULT NULL, + CONSTRAINT function_invocation_module_db_fkey + FOREIGN KEY(database_id) + REFERENCES metaschema_public.database (id) + ON DELETE CASCADE, + CONSTRAINT function_invocation_module_schema_fkey + FOREIGN KEY(schema_id) + REFERENCES metaschema_public.schema (id) + ON DELETE CASCADE, + CONSTRAINT function_invocation_module_private_schema_fkey + FOREIGN KEY(private_schema_id) + REFERENCES metaschema_public.schema (id) + ON DELETE CASCADE, + CONSTRAINT function_invocation_module_invocations_table_fkey + FOREIGN KEY(invocations_table_id) + REFERENCES metaschema_public.table (id) + ON DELETE CASCADE, + CONSTRAINT function_invocation_module_logs_table_fkey + FOREIGN KEY(execution_logs_table_id) + REFERENCES metaschema_public.table (id) + ON DELETE CASCADE, + CONSTRAINT function_invocation_module_entity_table_fkey + FOREIGN KEY(entity_table_id) + REFERENCES metaschema_public.table (id) + ON DELETE CASCADE +); + +CREATE INDEX function_invocation_module_database_id_idx ON metaschema_modules_public.function_invocation_module (database_id); + +CREATE UNIQUE INDEX function_invocation_module_unique_scope ON metaschema_modules_public.function_invocation_module (database_id, scope, prefix); + CREATE TABLE metaschema_modules_public.config_secrets_module ( id uuid PRIMARY KEY DEFAULT uuidv7(), database_id uuid NOT NULL, @@ -3090,15 +3137,15 @@ CREATE TABLE metaschema_modules_public.config_secrets_module ( ON DELETE CASCADE, CONSTRAINT config_secrets_module_table_fkey FOREIGN KEY(table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT config_secrets_module_config_defs_table_fkey FOREIGN KEY(config_definitions_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT config_secrets_module_entity_table_fkey FOREIGN KEY(entity_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -3132,7 +3179,7 @@ CREATE TABLE metaschema_modules_public.user_credentials_module ( ON DELETE CASCADE, CONSTRAINT user_credentials_module_table_fkey FOREIGN KEY(table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -3166,11 +3213,11 @@ CREATE TABLE metaschema_modules_public.user_settings_module ( ON DELETE CASCADE, CONSTRAINT table_fkey FOREIGN KEY(table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT owner_table_fkey FOREIGN KEY(owner_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -3200,7 +3247,7 @@ CREATE TABLE metaschema_modules_public.i18n_module ( ON DELETE CASCADE, CONSTRAINT settings_table_fkey FOREIGN KEY(settings_table_id) - REFERENCES metaschema_public."table" (id) + REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); diff --git a/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/function_invocation_module/table.sql b/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/function_invocation_module/table.sql new file mode 100644 index 00000000..dd5d24f5 --- /dev/null +++ b/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/function_invocation_module/table.sql @@ -0,0 +1,7 @@ +-- Verify schemas/metaschema_modules_public/tables/function_invocation_module/table on pg + +BEGIN; + +SELECT verify_table ('metaschema_modules_public.function_invocation_module'); + +ROLLBACK;