diff --git a/packages/function-resolution/__tests__/capabilities.test.ts b/packages/function-resolution/__tests__/capabilities.test.ts index b845d946..c33bdac1 100644 --- a/packages/function-resolution/__tests__/capabilities.test.ts +++ b/packages/function-resolution/__tests__/capabilities.test.ts @@ -175,8 +175,8 @@ describe('function-resolution capability resolution', () => { resource_installations_table_id, apps_table_id, buckets_table_id, sites_web_config_table_id, sites_error_pages_table_id, sites_app_links_table_id, sites_deep_links_table_id, - redirects_table_id, bindings_table_id, scope) - VALUES ($1, $2, $3, $3, $4, $3, $3, $3, $3, $3, $3, $5, $3, $3, $3, $3, $3, $6, 'database')`, + redirects_table_id, bindings_table_id, images_table_id, scope) + VALUES ($1, $2, $3, $3, $4, $3, $3, $3, $3, $3, $3, $5, $3, $3, $3, $3, $3, $6, $3, 'database')`, [ TENANT_DB, catFunctions.schemaId, diff --git a/packages/function-resolution/__tests__/catalog-fastpath.test.ts b/packages/function-resolution/__tests__/catalog-fastpath.test.ts index b68af768..1ed54cd9 100644 --- a/packages/function-resolution/__tests__/catalog-fastpath.test.ts +++ b/packages/function-resolution/__tests__/catalog-fastpath.test.ts @@ -200,8 +200,8 @@ describe('function-resolution catalog fast-path', () => { resource_installations_table_id, apps_table_id, buckets_table_id, sites_web_config_table_id, sites_error_pages_table_id, sites_app_links_table_id, sites_deep_links_table_id, - redirects_table_id, bindings_table_id, scope) - VALUES ($1, $2, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, 'app')`, + redirects_table_id, bindings_table_id, images_table_id, scope) + VALUES ($1, $2, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, 'app')`, [TENANT_DB, catSchema.id, catTable.id] ); diff --git a/packages/function-resolution/__tests__/published-capability-catalog.test.ts b/packages/function-resolution/__tests__/published-capability-catalog.test.ts index f6efe012..3b56d8b3 100644 --- a/packages/function-resolution/__tests__/published-capability-catalog.test.ts +++ b/packages/function-resolution/__tests__/published-capability-catalog.test.ts @@ -243,8 +243,8 @@ describe('capability resolution against the published catalog planes', () => { bindings_table_id, sites_web_config_table_id, sites_error_pages_table_id, sites_app_links_table_id, sites_deep_links_table_id, - redirects_table_id, scope) - VALUES ($1, $2, $3, $3, $4, $3, $3, $3, $3, $3, $3, $5, $6, $3, $3, $3, $3, $3, 'database')`, + redirects_table_id, images_table_id, scope) + VALUES ($1, $2, $3, $3, $4, $3, $3, $3, $3, $3, $3, $5, $6, $3, $3, $3, $3, $3, $3, 'database')`, [dbId, schemaId, bucketsTableId, apisTableId, bucketsTableId, bindingsTableId] ); // Label kept for readability of the fixture rows above. diff --git a/packages/function-resolution/__tests__/published-catalog.test.ts b/packages/function-resolution/__tests__/published-catalog.test.ts index 09e6559d..b491689d 100644 --- a/packages/function-resolution/__tests__/published-catalog.test.ts +++ b/packages/function-resolution/__tests__/published-catalog.test.ts @@ -147,8 +147,8 @@ describe('function-resolution against the published catalog plane', () => { resource_installations_table_id, apps_table_id, buckets_table_id, sites_web_config_table_id, sites_error_pages_table_id, sites_app_links_table_id, sites_deep_links_table_id, - redirects_table_id, bindings_table_id, scope) - VALUES ($1, $2, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, 'app')`, + redirects_table_id, bindings_table_id, images_table_id, scope) + VALUES ($1, $2, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, 'app')`, [dbId, schemaId, tableId] ); diff --git a/packages/function-resolution/__tests__/resolution.test.ts b/packages/function-resolution/__tests__/resolution.test.ts index 9d109ec6..6fdaf4dd 100644 --- a/packages/function-resolution/__tests__/resolution.test.ts +++ b/packages/function-resolution/__tests__/resolution.test.ts @@ -160,8 +160,8 @@ describe('function-resolution end-to-end (format-based, no AST)', () => { resource_installations_table_id, apps_table_id, buckets_table_id, sites_web_config_table_id, sites_error_pages_table_id, sites_app_links_table_id, sites_deep_links_table_id, - redirects_table_id, bindings_table_id, scope) - VALUES ($1, $2, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, 'app')`, + redirects_table_id, bindings_table_id, images_table_id, scope) + VALUES ($1, $2, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, $3, 'app')`, [TENANT_DB, catSchema.id, catTable.id] ); }); diff --git a/packages/function-resolution/deploy/schemas/function_resolution/procedures/image_catalog_row.sql b/packages/function-resolution/deploy/schemas/function_resolution/procedures/image_catalog_row.sql new file mode 100644 index 00000000..51a9fca7 --- /dev/null +++ b/packages/function-resolution/deploy/schemas/function_resolution/procedures/image_catalog_row.sql @@ -0,0 +1,82 @@ +-- Deploy schemas/function_resolution/procedures/image_catalog_row to pg + +-- requires: schemas/function_resolution/schema +-- requires: schemas/function_resolution/procedures/frame_candidates + +BEGIN; + +-- image_catalog_row: load one container image the execution is allowed to run. +-- +-- An image foreign key never leaves its own scope, so a tenant that runs a +-- platform-published image holds no reference to it: the reference is a name, +-- and this is where a name becomes coordinates. The frame candidates join +-- catalog_private.images nearest frame first, so a scope's own image shadows a +-- published one of the same name — the read-down is a fallback, not an override. +-- +-- The shared plane holds every database's rows, so each candidate carries the +-- row's expected database_id (its own key at database scope, the frame's lookup +-- database otherwise); without it a name could resolve against a row belonging +-- to another tenant. A row owned by another database additionally needs +-- is_visible (the source row's is_published), and platform_only rows are never +-- reachable from outside the database that owns them. +-- +-- Returns no row when the image is not reachable, leaving the fail-loud wording +-- to the caller, which knows what named it. +-- +-- plpgsql, not sql: this module is portable and deploys into databases that host +-- no catalog module, so catalog_private must be resolved on first call rather +-- than at CREATE FUNCTION time. +CREATE FUNCTION function_resolution.image_catalog_row( + database_id uuid, + scope text, + entity_id uuid, + image_name text +) RETURNS TABLE ( + image_id uuid, + name text, + registry_host text, + repository text, + tag text, + digest text, + runtime text, + labels jsonb, + owner_database_id uuid, + owner_scope text, + owner_key uuid +) AS $$ +BEGIN + RETURN QUERY + SELECT i.id, + i.name, + i.registry_host, + i.repository, + i.tag, + i.digest, + i.runtime, + i.labels, + i.database_id, + i.owner_scope, + i.owner_key + FROM function_resolution.frame_candidates( + image_catalog_row.database_id, + image_catalog_row.scope, + image_catalog_row.entity_id + ) cand + JOIN catalog_private.images i + ON i.owner_scope = cand.owner_scope + AND i.owner_key IS NOT DISTINCT FROM cand.owner_key + AND i.database_id = CASE + WHEN cand.owner_scope = 'database' THEN cand.owner_key + ELSE cand.lookup_database_id + END + WHERE i.name = image_catalog_row.image_name + AND ( + i.database_id = image_catalog_row.database_id + OR (i.is_visible AND NOT i.platform_only) + ) + ORDER BY cand.ord + LIMIT 1; +END; +$$ LANGUAGE plpgsql STABLE SECURITY DEFINER; + +COMMIT; diff --git a/packages/function-resolution/pgpm.plan b/packages/function-resolution/pgpm.plan index e6aeb36d..cce58829 100644 --- a/packages/function-resolution/pgpm.plan +++ b/packages/function-resolution/pgpm.plan @@ -22,3 +22,4 @@ schemas/function_resolution/procedures/bound_bucket_id [schemas/function_resolut schemas/function_resolution/procedures/resolve_payload_refs [schemas/function_resolution/schema schemas/function_resolution/procedures/resolve_bucket schemas/function_resolution/procedures/resolve_api] 2017-08-11T08:11:51Z constructive # tagged payload refs to coordinates schemas/function_resolution/procedures/resolve_capabilities [schemas/function_resolution/schema schemas/function_resolution/procedures/definitions_location schemas/function_resolution/procedures/frame_candidates schemas/function_resolution/procedures/resolve_bucket schemas/function_resolution/procedures/bucket_catalog_row schemas/function_resolution/procedures/bound_bucket_id schemas/function_resolution/procedures/resolve_api schemas/function_resolution/procedures/resolve_payload_refs] 2017-08-11T08:11:51Z constructive # resolve-before-dispatch capability bundle schemas/function_resolution/procedures/validate_capabilities [schemas/function_resolution/schema schemas/function_resolution/procedures/resolve_capabilities] 2017-08-11T08:11:51Z constructive # prove declarations resolvable +schemas/function_resolution/procedures/image_catalog_row [schemas/function_resolution/schema schemas/function_resolution/procedures/frame_candidates] 2017-08-11T08:11:51Z constructive # reachable image by name (nearest frame wins) diff --git a/packages/function-resolution/revert/schemas/function_resolution/procedures/image_catalog_row.sql b/packages/function-resolution/revert/schemas/function_resolution/procedures/image_catalog_row.sql new file mode 100644 index 00000000..a0c1c7b1 --- /dev/null +++ b/packages/function-resolution/revert/schemas/function_resolution/procedures/image_catalog_row.sql @@ -0,0 +1,7 @@ +-- Revert schemas/function_resolution/procedures/image_catalog_row from pg + +BEGIN; + +DROP FUNCTION function_resolution.image_catalog_row(uuid, text, uuid, text); + +COMMIT; diff --git a/packages/function-resolution/sql/pgpm-function-resolution--0.43.1.bundle.tar.gz b/packages/function-resolution/sql/pgpm-function-resolution--0.43.1.bundle.tar.gz index 1677ce99..888bed24 100644 Binary files a/packages/function-resolution/sql/pgpm-function-resolution--0.43.1.bundle.tar.gz and b/packages/function-resolution/sql/pgpm-function-resolution--0.43.1.bundle.tar.gz differ diff --git a/packages/function-resolution/sql/pgpm-function-resolution--0.43.1.sql b/packages/function-resolution/sql/pgpm-function-resolution--0.43.1.sql index d64bf13b..56d079dd 100644 --- a/packages/function-resolution/sql/pgpm-function-resolution--0.43.1.sql +++ b/packages/function-resolution/sql/pgpm-function-resolution--0.43.1.sql @@ -1594,4 +1594,57 @@ BEGIN validate_capabilities.channel ); END; +$EOFCODE$ LANGUAGE plpgsql STABLE SECURITY DEFINER; + +CREATE FUNCTION function_resolution.image_catalog_row( + database_id uuid, + scope text, + entity_id uuid, + image_name text +) RETURNS TABLE ( + image_id uuid, + name text, + registry_host text, + repository text, + tag text, + digest text, + runtime text, + labels jsonb, + owner_database_id uuid, + owner_scope text, + owner_key uuid +) AS $EOFCODE$ +BEGIN + RETURN QUERY + SELECT i.id, + i.name, + i.registry_host, + i.repository, + i.tag, + i.digest, + i.runtime, + i.labels, + i.database_id, + i.owner_scope, + i.owner_key + FROM function_resolution.frame_candidates( + image_catalog_row.database_id, + image_catalog_row.scope, + image_catalog_row.entity_id + ) cand + JOIN catalog_private.images i + ON i.owner_scope = cand.owner_scope + AND i.owner_key IS NOT DISTINCT FROM cand.owner_key + AND i.database_id = CASE + WHEN cand.owner_scope = 'database' THEN cand.owner_key + ELSE cand.lookup_database_id + END + WHERE i.name = image_catalog_row.image_name + AND ( + i.database_id = image_catalog_row.database_id + OR (i.is_visible AND NOT i.platform_only) + ) + ORDER BY cand.ord + LIMIT 1; +END; $EOFCODE$ LANGUAGE plpgsql STABLE SECURITY DEFINER; \ No newline at end of file diff --git a/packages/function-resolution/verify/schemas/function_resolution/procedures/image_catalog_row.sql b/packages/function-resolution/verify/schemas/function_resolution/procedures/image_catalog_row.sql new file mode 100644 index 00000000..7be45b8d --- /dev/null +++ b/packages/function-resolution/verify/schemas/function_resolution/procedures/image_catalog_row.sql @@ -0,0 +1,7 @@ +-- Verify schemas/function_resolution/procedures/image_catalog_row on pg + +BEGIN; + +SELECT assert_function('function_resolution.image_catalog_row(uuid, text, uuid, text)'::regprocedure); + +ROLLBACK; diff --git a/packages/metaschema-modules/__tests__/__snapshots__/modules.test.ts.snap b/packages/metaschema-modules/__tests__/__snapshots__/modules.test.ts.snap index 13a6770e..a5fdfa19 100644 --- a/packages/metaschema-modules/__tests__/__snapshots__/modules.test.ts.snap +++ b/packages/metaschema-modules/__tests__/__snapshots__/modules.test.ts.snap @@ -31,7 +31,6 @@ exports[`db_meta_modules should have all expected module tables 1`] = ` "graph_execution_module", "graph_module", "hierarchy_module", - "http_route_module", "i18n_module", "identity_providers_module", "image_module", @@ -85,8 +84,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": 76, - "totalTables": 85, + "moduleTablesCount": 75, + "totalTables": 84, } `; @@ -153,13 +152,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": 76, + "constraintCount": 75, } `; exports[`db_meta_modules should verify module tables have proper foreign key relationships 1`] = ` { - "constraintCount": 551, + "constraintCount": 546, "foreignTables": [ "catalog_module", "database", @@ -171,10 +170,8 @@ exports[`db_meta_modules should verify module tables have proper foreign key rel "infra_secrets_module", "merkle_store_module", "namespace_module", - "resource_module", "schema", "site_surface_module", - "storage_module", "table", ], } diff --git a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/catalog_module/table.sql b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/catalog_module/table.sql index 812f4516..1fad9c05 100644 --- a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/catalog_module/table.sql +++ b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/catalog_module/table.sql @@ -7,7 +7,7 @@ BEGIN; -- Typed catalog module configuration: one row per database installs the typed -- catalog tables (catalog_private.domains / apis / sites / namespaces / -- functions / resources / resource_definitions / resource_installations / --- apps / buckets / redirects / bindings). The catalog is +-- apps / buckets / images / redirects / bindings). The catalog is -- a system projection surface holding ALL scopes of each type; scoped source -- tables register into it via catalog_register. The stable schema-qualified -- table names are load-bearing deployment contracts. @@ -32,6 +32,7 @@ CREATE TABLE metaschema_modules_public.catalog_module ( resource_installations_table_id uuid NOT NULL DEFAULT uuid_nil(), apps_table_id uuid NOT NULL DEFAULT uuid_nil(), buckets_table_id uuid NOT NULL DEFAULT uuid_nil(), + images_table_id uuid NOT NULL DEFAULT uuid_nil(), bindings_table_id uuid NOT NULL DEFAULT uuid_nil(), sites_web_config_table_id uuid NOT NULL DEFAULT uuid_nil(), sites_error_pages_table_id uuid NOT NULL DEFAULT uuid_nil(), @@ -50,6 +51,7 @@ CREATE TABLE metaschema_modules_public.catalog_module ( resource_installations_table_name text NOT NULL DEFAULT 'resource_installations', apps_table_name text NOT NULL DEFAULT 'apps', buckets_table_name text NOT NULL DEFAULT 'buckets', + images_table_name text NOT NULL DEFAULT 'images', bindings_table_name text NOT NULL DEFAULT 'bindings', sites_web_config_table_name text NOT NULL DEFAULT 'sites_web_config', sites_error_pages_table_name text NOT NULL DEFAULT 'sites_error_pages', @@ -125,6 +127,10 @@ CREATE TABLE metaschema_modules_public.catalog_module ( FOREIGN KEY (buckets_table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE, + CONSTRAINT catalog_module_images_table_fkey + FOREIGN KEY (images_table_id) + REFERENCES metaschema_public.table (id) + ON DELETE CASCADE, CONSTRAINT catalog_module_bindings_table_fkey FOREIGN KEY (bindings_table_id) REFERENCES metaschema_public.table (id) @@ -162,6 +168,7 @@ CREATE UNIQUE INDEX catalog_module_unique_database CREATE INDEX catalog_module_apis_table_id_idx ON metaschema_modules_public.catalog_module ( apis_table_id ); CREATE INDEX catalog_module_apps_table_id_idx ON metaschema_modules_public.catalog_module ( apps_table_id ); CREATE INDEX catalog_module_buckets_table_id_idx ON metaschema_modules_public.catalog_module ( buckets_table_id ); +CREATE INDEX catalog_module_images_table_id_idx ON metaschema_modules_public.catalog_module ( images_table_id ); CREATE INDEX catalog_module_bindings_table_id_idx ON metaschema_modules_public.catalog_module ( bindings_table_id ); CREATE INDEX catalog_module_sites_web_config_table_id_idx ON metaschema_modules_public.catalog_module ( sites_web_config_table_id ); CREATE INDEX catalog_module_sites_error_pages_table_id_idx ON metaschema_modules_public.catalog_module ( sites_error_pages_table_id ); @@ -188,6 +195,7 @@ COMMENT ON COLUMN metaschema_modules_public.catalog_module.bindings_table_id IS COMMENT ON COLUMN metaschema_modules_public.catalog_module.buckets_table_id IS '@module_table'; COMMENT ON COLUMN metaschema_modules_public.catalog_module.domains_table_id IS '@module_table'; COMMENT ON COLUMN metaschema_modules_public.catalog_module.functions_table_id IS '@module_table'; +COMMENT ON COLUMN metaschema_modules_public.catalog_module.images_table_id IS '@module_table'; COMMENT ON COLUMN metaschema_modules_public.catalog_module.namespaces_table_id IS '@module_table'; COMMENT ON COLUMN metaschema_modules_public.catalog_module.resource_definitions_table_id IS '@module_table'; COMMENT ON COLUMN metaschema_modules_public.catalog_module.resource_installations_table_id IS '@module_table'; diff --git a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/compute_log_module/table.sql b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/compute_log_module/table.sql index d246641e..910b609f 100644 --- a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/compute_log_module/table.sql +++ b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/compute_log_module/table.sql @@ -33,14 +33,20 @@ CREATE TABLE metaschema_modules_public.compute_log_module ( retention text NOT NULL DEFAULT '12 months', premake int NOT NULL DEFAULT 2, - -- Scope configuration: 'app' = per-app usage (actor_id RLS) + -- Scope the log plane is installed at. Rows are read through + -- entity membership on entity_id at every scope, plus the actor's own rows + -- outside the constructive scopes. scope text NOT NULL, - actor_fk_table_id uuid NULL, - entity_fk_table_id uuid NULL, -- Table name prefix. Auto-derived from scope by the trigger when empty. prefix text NOT NULL DEFAULT '', + -- Name of the AST-generated rollup function in the private schema. It + -- carries the same prefix as the tables, so two scopes of this module + -- share one private schema without colliding, and a reader (the worker's + -- rollup pass) calls the function belonging to the instance it loaded. + rollup_function_name text NOT NULL DEFAULT '', + -- API routing (configurable per-module) api_name text DEFAULT 'usage', private_api_name text DEFAULT NULL, diff --git a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/http_route_module/table.sql b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/http_route_module/table.sql deleted file mode 100644 index 599973de..00000000 --- a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/http_route_module/table.sql +++ /dev/null @@ -1,89 +0,0 @@ --- Deploy schemas/metaschema_modules_public/tables/http_route_module/table to pg - --- requires: schemas/metaschema_modules_public/schema --- requires: schemas/metaschema_modules_public/tables/function_module/table --- requires: schemas/metaschema_modules_public/tables/resource_module/table --- requires: schemas/metaschema_modules_public/tables/storage_module/table - -BEGIN; - -CREATE TABLE metaschema_modules_public.http_route_module ( - id uuid PRIMARY KEY DEFAULT uuidv7(), - database_id uuid NOT NULL, - entity_field text, - - 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, - - http_routes_table_id uuid NOT NULL DEFAULT uuid_nil(), - http_routes_table_name text NOT NULL DEFAULT 'http_routes', - resolver_function_name text, - - function_module_id uuid, - resource_module_id uuid, - storage_module_id uuid, - - api_name text, - private_api_name text, - - scope text NOT NULL, - prefix text NOT NULL DEFAULT '', - entity_table_id uuid NULL, - - policies jsonb NULL, - provisions jsonb NULL, - default_capabilities text[] DEFAULT NULL, - - CONSTRAINT http_route_module_db_fkey - FOREIGN KEY (database_id) - REFERENCES metaschema_public.database (id) - ON DELETE CASCADE, - CONSTRAINT http_route_module_schema_fkey - FOREIGN KEY (schema_id) - REFERENCES metaschema_public.schema (id) - ON DELETE CASCADE, - CONSTRAINT http_route_module_private_schema_fkey - FOREIGN KEY (private_schema_id) - REFERENCES metaschema_public.schema (id) - ON DELETE CASCADE, - CONSTRAINT http_route_module_routes_table_fkey - FOREIGN KEY (http_routes_table_id) - REFERENCES metaschema_public.table (id) - ON DELETE CASCADE, - CONSTRAINT http_route_module_function_module_fkey - FOREIGN KEY (function_module_id) - REFERENCES metaschema_modules_public.function_module (id) - ON DELETE CASCADE, - CONSTRAINT http_route_module_resource_module_fkey - FOREIGN KEY (resource_module_id) - REFERENCES metaschema_modules_public.resource_module (id) - ON DELETE CASCADE, - CONSTRAINT http_route_module_storage_module_fkey - FOREIGN KEY (storage_module_id) - REFERENCES metaschema_modules_public.storage_module (id) - ON DELETE CASCADE, - CONSTRAINT http_route_module_entity_table_fkey - FOREIGN KEY (entity_table_id) - REFERENCES metaschema_public.table (id) - ON DELETE CASCADE -); - -CREATE UNIQUE INDEX http_route_module_unique_scope - ON metaschema_modules_public.http_route_module (database_id, scope); -CREATE INDEX http_route_module_entity_table_id_idx ON metaschema_modules_public.http_route_module ( entity_table_id ); -CREATE INDEX http_route_module_http_routes_table_id_idx ON metaschema_modules_public.http_route_module ( http_routes_table_id ); -CREATE INDEX http_route_module_private_schema_id_idx ON metaschema_modules_public.http_route_module ( private_schema_id ); -CREATE INDEX http_route_module_schema_id_idx ON metaschema_modules_public.http_route_module ( schema_id ); -CREATE INDEX http_route_module_function_module_id_idx ON metaschema_modules_public.http_route_module ( function_module_id ); -CREATE INDEX http_route_module_resource_module_id_idx ON metaschema_modules_public.http_route_module ( resource_module_id ); -CREATE INDEX http_route_module_storage_module_id_idx ON metaschema_modules_public.http_route_module ( storage_module_id ); - --- Tables this module generates, as opposed to tables it is handed (an --- entity or users table it points at): the @module_table marker is what --- metaschema_modules_private.tg_module_install_provenance attributes to this --- install, keyed by the role name in the column. -COMMENT ON COLUMN metaschema_modules_public.http_route_module.http_routes_table_id IS '@module_table'; - -COMMIT; diff --git a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/image_module/table.sql b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/image_module/table.sql index 84ea1095..509f2b44 100644 --- a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/image_module/table.sql +++ b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/image_module/table.sql @@ -24,10 +24,17 @@ CREATE TABLE metaschema_modules_public.image_module ( -- Generated table IDs (populated by the generator) images_table_id uuid NOT NULL DEFAULT uuid_nil(), image_grants_table_id uuid NOT NULL DEFAULT uuid_nil(), + -- The registry endpoint catalog installs with the artifact catalog: a + -- registry row is (kind, host, base_path, auth) whatever the ecosystem, so + -- it is one table here rather than one per artifact kind. + registries_table_id uuid NOT NULL DEFAULT uuid_nil(), + registry_grants_table_id uuid NOT NULL DEFAULT uuid_nil(), -- Table names (input to the generator) images_table_name text NOT NULL DEFAULT 'images', image_grants_table_name text NOT NULL DEFAULT 'image_grants', + registries_table_name text NOT NULL DEFAULT 'registries', + registry_grants_table_name text NOT NULL DEFAULT 'registry_grants', -- API routing (get-or-create: if set, schema is added to this API; if NULL, no API is added) api_name text, @@ -46,7 +53,7 @@ CREATE TABLE metaschema_modules_public.image_module ( policies jsonb NULL, -- Per-table provisions overrides from blueprint config. - -- Keys are table keys (images, image_grants). + -- Keys are table keys (images, image_grants, registries, registry_grants). provisions jsonb NULL, -- Default capabilities: capability names auto-granted to new members. @@ -57,6 +64,8 @@ CREATE TABLE metaschema_modules_public.image_module ( CONSTRAINT image_module_private_schema_fkey FOREIGN KEY (private_schema_id) REFERENCES metaschema_public.schema (id) ON DELETE CASCADE, CONSTRAINT image_module_images_table_fkey FOREIGN KEY (images_table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT image_module_grants_table_fkey FOREIGN KEY (image_grants_table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE, + CONSTRAINT image_module_registries_table_fkey FOREIGN KEY (registries_table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE, + CONSTRAINT image_module_registry_grants_table_fkey FOREIGN KEY (registry_grants_table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE, CONSTRAINT image_module_entity_table_fkey FOREIGN KEY (entity_table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE ); @@ -66,6 +75,8 @@ CREATE UNIQUE INDEX image_module_unique_scope ON metaschema_modules_public.image CREATE INDEX image_module_entity_table_id_idx ON metaschema_modules_public.image_module ( entity_table_id ); CREATE INDEX image_module_images_table_id_idx ON metaschema_modules_public.image_module ( images_table_id ); CREATE INDEX image_module_image_grants_table_id_idx ON metaschema_modules_public.image_module ( image_grants_table_id ); +CREATE INDEX image_module_registries_table_id_idx ON metaschema_modules_public.image_module ( registries_table_id ); +CREATE INDEX image_module_registry_grants_table_id_idx ON metaschema_modules_public.image_module ( registry_grants_table_id ); CREATE INDEX image_module_private_schema_id_idx ON metaschema_modules_public.image_module ( private_schema_id ); CREATE INDEX image_module_schema_id_idx ON metaschema_modules_public.image_module ( schema_id ); @@ -75,5 +86,7 @@ CREATE INDEX image_module_schema_id_idx ON metaschema_modules_public.image_modul -- install, keyed by the role name in the column. COMMENT ON COLUMN metaschema_modules_public.image_module.images_table_id IS '@module_table'; COMMENT ON COLUMN metaschema_modules_public.image_module.image_grants_table_id IS '@module_table'; +COMMENT ON COLUMN metaschema_modules_public.image_module.registries_table_id IS '@module_table'; +COMMENT ON COLUMN metaschema_modules_public.image_module.registry_grants_table_id IS '@module_table'; COMMIT; diff --git a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/inference_log_module/table.sql b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/inference_log_module/table.sql index d1dc50d7..a0df776a 100644 --- a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/inference_log_module/table.sql +++ b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/inference_log_module/table.sql @@ -33,14 +33,20 @@ CREATE TABLE metaschema_modules_public.inference_log_module ( retention text NOT NULL DEFAULT '12 months', premake int NOT NULL DEFAULT 2, - -- Scope configuration: 'app' = per-app usage (actor_id RLS) + -- Scope the log plane is installed at. Rows are read through + -- entity membership on entity_id at every scope, plus the actor's own rows + -- outside the constructive scopes. scope text NOT NULL, - actor_fk_table_id uuid NULL, - entity_fk_table_id uuid NULL, -- Table name prefix. Auto-derived from scope by the trigger when empty. prefix text NOT NULL DEFAULT '', + -- Name of the AST-generated rollup function in the private schema. It + -- carries the same prefix as the tables, so two scopes of this module + -- share one private schema without colliding, and a reader (the worker's + -- rollup pass) calls the function belonging to the instance it loaded. + rollup_function_name text NOT NULL DEFAULT '', + -- API routing (configurable per-module) api_name text DEFAULT 'usage', private_api_name text DEFAULT NULL, diff --git a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/repository_module/table.sql b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/repository_module/table.sql index bcec1b6d..dd90361e 100644 --- a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/repository_module/table.sql +++ b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/repository_module/table.sql @@ -55,6 +55,15 @@ CREATE TABLE metaschema_modules_public.repository_module ( -- provisioning raises rather than accepting a file it has nowhere to put. has_attachments boolean NOT NULL DEFAULT false, + -- Search/embedding configuration for the prose tables: dimensions, + -- embedding_model, embedding_provider, chunk_size, chunk_overlap, + -- chunk_strategy, has_chunks. NULL takes the defaults (768d, paragraph + -- chunking, chunks on). One config for the module rather than one per table: + -- a proposal and its comments are ranked together, and two embedding models + -- would make one result set incomparable. + -- Example: {"dimensions": 1536, "embedding_provider": "openai"} + search jsonb NULL, + -- 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, diff --git a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/storage_log_module/table.sql b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/storage_log_module/table.sql index bc4325bb..d2583c4e 100644 --- a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/storage_log_module/table.sql +++ b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/storage_log_module/table.sql @@ -33,14 +33,20 @@ CREATE TABLE metaschema_modules_public.storage_log_module ( retention text NOT NULL DEFAULT '12 months', premake int NOT NULL DEFAULT 2, - -- Scope configuration: 'app' = per-app usage (actor_id RLS) + -- Scope the log plane is installed at. Rows are read through + -- entity membership on entity_id at every scope, plus the actor's own rows + -- outside the constructive scopes. scope text NOT NULL, - actor_fk_table_id uuid NULL, - entity_fk_table_id uuid NULL, -- Table name prefix. Auto-derived from scope by the trigger when empty. prefix text NOT NULL DEFAULT '', + -- Name of the AST-generated rollup function in the private schema. It + -- carries the same prefix as the tables, so two scopes of this module + -- share one private schema without colliding, and a reader (the worker's + -- rollup pass) calls the function belonging to the instance it loaded. + rollup_function_name text NOT NULL DEFAULT '', + -- API routing (configurable per-module) api_name text DEFAULT 'usage', private_api_name text DEFAULT NULL, diff --git a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/transfer_log_module/table.sql b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/transfer_log_module/table.sql index a7202a4d..9dad071b 100644 --- a/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/transfer_log_module/table.sql +++ b/packages/metaschema-modules/deploy/schemas/metaschema_modules_public/tables/transfer_log_module/table.sql @@ -33,14 +33,20 @@ CREATE TABLE metaschema_modules_public.transfer_log_module ( retention text NOT NULL DEFAULT '12 months', premake int NOT NULL DEFAULT 2, - -- Scope configuration: 'app' = per-app usage (actor_id RLS) + -- Scope the log plane is installed at. Rows are read through + -- entity membership on entity_id at every scope, plus the actor's own rows + -- outside the constructive scopes. scope text NOT NULL, - actor_fk_table_id uuid NULL, - entity_fk_table_id uuid NULL, -- Table name prefix. Auto-derived from scope by the trigger when empty. prefix text NOT NULL DEFAULT '', + -- Name of the AST-generated rollup function in the private schema. It + -- carries the same prefix as the tables, so two scopes of this module + -- share one private schema without colliding, and a reader (the worker's + -- rollup pass) calls the function belonging to the instance it loaded. + rollup_function_name text NOT NULL DEFAULT '', + -- API routing (configurable per-module) api_name text DEFAULT 'usage', private_api_name text DEFAULT NULL, diff --git a/packages/metaschema-modules/pgpm.plan b/packages/metaschema-modules/pgpm.plan index 01200b12..dce159b1 100644 --- a/packages/metaschema-modules/pgpm.plan +++ b/packages/metaschema-modules/pgpm.plan @@ -79,7 +79,6 @@ schemas/metaschema_modules_public/tables/transfer_log_module/constraints/one_pla schemas/metaschema_modules_public/tables/storage_log_module/constraints/one_platform_scope [schemas/metaschema_modules_public/tables/storage_log_module/table] 2026-07-08T07:30:00Z devin # enforce at most one platform-scope storage_log_module per database schemas/metaschema_modules_public/tables/db_usage_module/constraints/one_platform_scope [schemas/metaschema_modules_public/tables/db_usage_module/table] 2026-07-08T07:30:00Z devin # enforce at most one platform-scope db_usage_module per database schemas/metaschema_modules_public/tables/webhook_module/table [schemas/metaschema_modules_public/schema schemas/metaschema_modules_public/tables/function_module/table schemas/metaschema_modules_public/tables/function_invocation_module/table schemas/metaschema_modules_public/tables/infra_secrets_module/table schemas/metaschema_modules_public/tables/namespace_module/table] 2026-07-15T06:30:00Z devin # add scoped webhook ingress module registration -schemas/metaschema_modules_public/tables/http_route_module/table [schemas/metaschema_modules_public/schema schemas/metaschema_modules_public/tables/function_module/table schemas/metaschema_modules_public/tables/resource_module/table schemas/metaschema_modules_public/tables/storage_module/table] 2026-07-15T23:41:00Z devin # add generated HTTP route module config schemas/metaschema_modules_public/tables/catalog_module/table [schemas/metaschema_modules_public/schema] 2026-07-19T12:00:00Z devin # add typed catalog module config (domains/apis/sites) schemas/metaschema_modules_public/tables/domain_module/table [schemas/metaschema_modules_public/schema schemas/metaschema_modules_public/tables/catalog_module/table] 2026-07-19T12:00:01Z devin # add scoped domain module config schemas/metaschema_modules_public/tables/api_surface_module/table [schemas/metaschema_modules_public/schema schemas/metaschema_modules_public/tables/catalog_module/table] 2026-07-19T12:00:02Z devin # add scoped api module config diff --git a/packages/metaschema-modules/revert/schemas/metaschema_modules_public/tables/http_route_module/table.sql b/packages/metaschema-modules/revert/schemas/metaschema_modules_public/tables/http_route_module/table.sql deleted file mode 100644 index eb82d040..00000000 --- a/packages/metaschema-modules/revert/schemas/metaschema_modules_public/tables/http_route_module/table.sql +++ /dev/null @@ -1,7 +0,0 @@ --- Revert schemas/metaschema_modules_public/tables/http_route_module/table from pg - -BEGIN; - -DROP TABLE metaschema_modules_public.http_route_module; - -COMMIT; diff --git a/packages/metaschema-modules/sql/metaschema-modules--0.43.1.bundle.tar.gz b/packages/metaschema-modules/sql/metaschema-modules--0.43.1.bundle.tar.gz index 5fedabd6..7a7c2974 100644 Binary files a/packages/metaschema-modules/sql/metaschema-modules--0.43.1.bundle.tar.gz and b/packages/metaschema-modules/sql/metaschema-modules--0.43.1.bundle.tar.gz differ diff --git a/packages/metaschema-modules/sql/metaschema-modules--0.43.1.sql b/packages/metaschema-modules/sql/metaschema-modules--0.43.1.sql index 8bd37acc..288a3912 100644 --- a/packages/metaschema-modules/sql/metaschema-modules--0.43.1.sql +++ b/packages/metaschema-modules/sql/metaschema-modules--0.43.1.sql @@ -3133,9 +3133,8 @@ CREATE TABLE metaschema_modules_public.inference_log_module ( retention text NOT NULL DEFAULT '12 months', premake int NOT NULL DEFAULT 2, scope text NOT NULL, - actor_fk_table_id uuid NULL, - entity_fk_table_id uuid NULL, prefix text NOT NULL DEFAULT '', + rollup_function_name text NOT NULL DEFAULT '', api_name text DEFAULT 'usage', private_api_name text DEFAULT NULL, CONSTRAINT db_fkey @@ -3190,9 +3189,8 @@ CREATE TABLE metaschema_modules_public.compute_log_module ( retention text NOT NULL DEFAULT '12 months', premake int NOT NULL DEFAULT 2, scope text NOT NULL, - actor_fk_table_id uuid NULL, - entity_fk_table_id uuid NULL, prefix text NOT NULL DEFAULT '', + rollup_function_name text NOT NULL DEFAULT '', api_name text DEFAULT 'usage', private_api_name text DEFAULT NULL, CONSTRAINT db_fkey @@ -3247,9 +3245,8 @@ CREATE TABLE metaschema_modules_public.transfer_log_module ( retention text NOT NULL DEFAULT '12 months', premake int NOT NULL DEFAULT 2, scope text NOT NULL, - actor_fk_table_id uuid NULL, - entity_fk_table_id uuid NULL, prefix text NOT NULL DEFAULT '', + rollup_function_name text NOT NULL DEFAULT '', api_name text DEFAULT 'usage', private_api_name text DEFAULT NULL, CONSTRAINT db_fkey @@ -3304,9 +3301,8 @@ CREATE TABLE metaschema_modules_public.storage_log_module ( retention text NOT NULL DEFAULT '12 months', premake int NOT NULL DEFAULT 2, scope text NOT NULL, - actor_fk_table_id uuid NULL, - entity_fk_table_id uuid NULL, prefix text NOT NULL DEFAULT '', + rollup_function_name text NOT NULL DEFAULT '', api_name text DEFAULT 'usage', private_api_name text DEFAULT NULL, CONSTRAINT db_fkey @@ -4865,80 +4861,6 @@ COMMENT ON COLUMN metaschema_modules_public.webhook_module.webhook_endpoints_tab COMMENT ON COLUMN metaschema_modules_public.webhook_module.webhook_events_table_id IS '@module_table'; -CREATE TABLE metaschema_modules_public.http_route_module ( - id uuid PRIMARY KEY DEFAULT uuidv7(), - database_id uuid NOT NULL, - entity_field text, - 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, - http_routes_table_id uuid NOT NULL DEFAULT uuid_nil(), - http_routes_table_name text NOT NULL DEFAULT 'http_routes', - resolver_function_name text, - function_module_id uuid, - resource_module_id uuid, - storage_module_id uuid, - api_name text, - private_api_name text, - scope text NOT NULL, - prefix text NOT NULL DEFAULT '', - entity_table_id uuid NULL, - policies jsonb NULL, - provisions jsonb NULL, - default_capabilities text[] DEFAULT NULL, - CONSTRAINT http_route_module_db_fkey - FOREIGN KEY(database_id) - REFERENCES metaschema_public.database (id) - ON DELETE CASCADE, - CONSTRAINT http_route_module_schema_fkey - FOREIGN KEY(schema_id) - REFERENCES metaschema_public.schema (id) - ON DELETE CASCADE, - CONSTRAINT http_route_module_private_schema_fkey - FOREIGN KEY(private_schema_id) - REFERENCES metaschema_public.schema (id) - ON DELETE CASCADE, - CONSTRAINT http_route_module_routes_table_fkey - FOREIGN KEY(http_routes_table_id) - REFERENCES metaschema_public.table (id) - ON DELETE CASCADE, - CONSTRAINT http_route_module_function_module_fkey - FOREIGN KEY(function_module_id) - REFERENCES metaschema_modules_public.function_module (id) - ON DELETE CASCADE, - CONSTRAINT http_route_module_resource_module_fkey - FOREIGN KEY(resource_module_id) - REFERENCES metaschema_modules_public.resource_module (id) - ON DELETE CASCADE, - CONSTRAINT http_route_module_storage_module_fkey - FOREIGN KEY(storage_module_id) - REFERENCES metaschema_modules_public.storage_module (id) - ON DELETE CASCADE, - CONSTRAINT http_route_module_entity_table_fkey - FOREIGN KEY(entity_table_id) - REFERENCES metaschema_public.table (id) - ON DELETE CASCADE -); - -CREATE UNIQUE INDEX http_route_module_unique_scope ON metaschema_modules_public.http_route_module (database_id, scope); - -CREATE INDEX http_route_module_entity_table_id_idx ON metaschema_modules_public.http_route_module (entity_table_id); - -CREATE INDEX http_route_module_http_routes_table_id_idx ON metaschema_modules_public.http_route_module (http_routes_table_id); - -CREATE INDEX http_route_module_private_schema_id_idx ON metaschema_modules_public.http_route_module (private_schema_id); - -CREATE INDEX http_route_module_schema_id_idx ON metaschema_modules_public.http_route_module (schema_id); - -CREATE INDEX http_route_module_function_module_id_idx ON metaschema_modules_public.http_route_module (function_module_id); - -CREATE INDEX http_route_module_resource_module_id_idx ON metaschema_modules_public.http_route_module (resource_module_id); - -CREATE INDEX http_route_module_storage_module_id_idx ON metaschema_modules_public.http_route_module (storage_module_id); - -COMMENT ON COLUMN metaschema_modules_public.http_route_module.http_routes_table_id IS '@module_table'; - CREATE TABLE metaschema_modules_public.catalog_module ( id uuid PRIMARY KEY DEFAULT uuidv7(), database_id uuid NOT NULL, @@ -4954,6 +4876,7 @@ CREATE TABLE metaschema_modules_public.catalog_module ( resource_installations_table_id uuid NOT NULL DEFAULT uuid_nil(), apps_table_id uuid NOT NULL DEFAULT uuid_nil(), buckets_table_id uuid NOT NULL DEFAULT uuid_nil(), + images_table_id uuid NOT NULL DEFAULT uuid_nil(), bindings_table_id uuid NOT NULL DEFAULT uuid_nil(), sites_web_config_table_id uuid NOT NULL DEFAULT uuid_nil(), sites_error_pages_table_id uuid NOT NULL DEFAULT uuid_nil(), @@ -4970,6 +4893,7 @@ CREATE TABLE metaschema_modules_public.catalog_module ( resource_installations_table_name text NOT NULL DEFAULT 'resource_installations', apps_table_name text NOT NULL DEFAULT 'apps', buckets_table_name text NOT NULL DEFAULT 'buckets', + images_table_name text NOT NULL DEFAULT 'images', bindings_table_name text NOT NULL DEFAULT 'bindings', sites_web_config_table_name text NOT NULL DEFAULT 'sites_web_config', sites_error_pages_table_name text NOT NULL DEFAULT 'sites_error_pages', @@ -5031,6 +4955,10 @@ CREATE TABLE metaschema_modules_public.catalog_module ( FOREIGN KEY(buckets_table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE, + CONSTRAINT catalog_module_images_table_fkey + FOREIGN KEY(images_table_id) + REFERENCES metaschema_public.table (id) + ON DELETE CASCADE, CONSTRAINT catalog_module_bindings_table_fkey FOREIGN KEY(bindings_table_id) REFERENCES metaschema_public.table (id) @@ -5069,6 +4997,8 @@ CREATE INDEX catalog_module_apps_table_id_idx ON metaschema_modules_public.catal CREATE INDEX catalog_module_buckets_table_id_idx ON metaschema_modules_public.catalog_module (buckets_table_id); +CREATE INDEX catalog_module_images_table_id_idx ON metaschema_modules_public.catalog_module (images_table_id); + CREATE INDEX catalog_module_bindings_table_id_idx ON metaschema_modules_public.catalog_module (bindings_table_id); CREATE INDEX catalog_module_sites_web_config_table_id_idx ON metaschema_modules_public.catalog_module (sites_web_config_table_id); @@ -5111,6 +5041,8 @@ COMMENT ON COLUMN metaschema_modules_public.catalog_module.domains_table_id IS ' COMMENT ON COLUMN metaschema_modules_public.catalog_module.functions_table_id IS '@module_table'; +COMMENT ON COLUMN metaschema_modules_public.catalog_module.images_table_id IS '@module_table'; + COMMENT ON COLUMN metaschema_modules_public.catalog_module.namespaces_table_id IS '@module_table'; COMMENT ON COLUMN metaschema_modules_public.catalog_module.resource_definitions_table_id IS '@module_table'; @@ -6177,8 +6109,12 @@ CREATE TABLE metaschema_modules_public.image_module ( private_schema_name text, images_table_id uuid NOT NULL DEFAULT uuid_nil(), image_grants_table_id uuid NOT NULL DEFAULT uuid_nil(), + registries_table_id uuid NOT NULL DEFAULT uuid_nil(), + registry_grants_table_id uuid NOT NULL DEFAULT uuid_nil(), images_table_name text NOT NULL DEFAULT 'images', image_grants_table_name text NOT NULL DEFAULT 'image_grants', + registries_table_name text NOT NULL DEFAULT 'registries', + registry_grants_table_name text NOT NULL DEFAULT 'registry_grants', api_name text, private_api_name text, scope text NOT NULL, @@ -6207,6 +6143,14 @@ CREATE TABLE metaschema_modules_public.image_module ( FOREIGN KEY(image_grants_table_id) REFERENCES metaschema_public.table (id) ON DELETE CASCADE, + CONSTRAINT image_module_registries_table_fkey + FOREIGN KEY(registries_table_id) + REFERENCES metaschema_public.table (id) + ON DELETE CASCADE, + CONSTRAINT image_module_registry_grants_table_fkey + FOREIGN KEY(registry_grants_table_id) + REFERENCES metaschema_public.table (id) + ON DELETE CASCADE, CONSTRAINT image_module_entity_table_fkey FOREIGN KEY(entity_table_id) REFERENCES metaschema_public.table (id) @@ -6221,6 +6165,10 @@ CREATE INDEX image_module_images_table_id_idx ON metaschema_modules_public.image CREATE INDEX image_module_image_grants_table_id_idx ON metaschema_modules_public.image_module (image_grants_table_id); +CREATE INDEX image_module_registries_table_id_idx ON metaschema_modules_public.image_module (registries_table_id); + +CREATE INDEX image_module_registry_grants_table_id_idx ON metaschema_modules_public.image_module (registry_grants_table_id); + CREATE INDEX image_module_private_schema_id_idx ON metaschema_modules_public.image_module (private_schema_id); CREATE INDEX image_module_schema_id_idx ON metaschema_modules_public.image_module (schema_id); @@ -6229,6 +6177,10 @@ COMMENT ON COLUMN metaschema_modules_public.image_module.images_table_id IS '@mo COMMENT ON COLUMN metaschema_modules_public.image_module.image_grants_table_id IS '@module_table'; +COMMENT ON COLUMN metaschema_modules_public.image_module.registries_table_id IS '@module_table'; + +COMMENT ON COLUMN metaschema_modules_public.image_module.registry_grants_table_id IS '@module_table'; + CREATE TABLE metaschema_modules_public.repository_module ( id uuid PRIMARY KEY DEFAULT uuidv7(), database_id uuid NOT NULL, @@ -6259,6 +6211,7 @@ CREATE TABLE metaschema_modules_public.repository_module ( proposal_file_views_table_name text NOT NULL DEFAULT 'proposal_file_views', has_builds boolean NOT NULL DEFAULT false, has_attachments boolean NOT NULL DEFAULT false, + search jsonb NULL, api_name text, private_api_name text, scope text NOT NULL, diff --git a/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/catalog_module/table.sql b/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/catalog_module/table.sql index 78513767..133d7329 100644 --- a/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/catalog_module/table.sql +++ b/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/catalog_module/table.sql @@ -3,6 +3,7 @@ BEGIN; SELECT id, database_id, scope, domains_table_id, apis_table_id, sites_table_id, + images_table_id, images_table_name, redirects_table_id, redirects_table_name FROM metaschema_modules_public.catalog_module WHERE false; diff --git a/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/compute_log_module/table.sql b/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/compute_log_module/table.sql index 2b9afc9c..f01d342e 100644 --- a/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/compute_log_module/table.sql +++ b/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/compute_log_module/table.sql @@ -4,7 +4,6 @@ SELECT id, database_id, schema_id, private_schema_id, compute_log_table_id, compute_log_table_name, usage_summary_table_id, usage_summary_table_name, retention, premake, - actor_fk_table_id, entity_fk_table_id, prefix FROM metaschema_modules_public.compute_log_module WHERE FALSE; diff --git a/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/http_route_module/table.sql b/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/http_route_module/table.sql deleted file mode 100644 index 84dcb263..00000000 --- a/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/http_route_module/table.sql +++ /dev/null @@ -1,9 +0,0 @@ --- Verify schemas/metaschema_modules_public/tables/http_route_module/table on pg - -BEGIN; - -SELECT id, database_id, scope, http_routes_table_id -FROM metaschema_modules_public.http_route_module -WHERE false; - -ROLLBACK; diff --git a/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/image_module/table.sql b/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/image_module/table.sql index 01f76edb..c6e31580 100644 --- a/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/image_module/table.sql +++ b/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/image_module/table.sql @@ -3,6 +3,8 @@ SELECT id, database_id, schema_id, private_schema_id, images_table_id, images_table_name, image_grants_table_id, image_grants_table_name, + registries_table_id, registries_table_name, + registry_grants_table_id, registry_grants_table_name, scope, prefix, entity_table_id, policies, provisions FROM metaschema_modules_public.image_module WHERE FALSE; diff --git a/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/inference_log_module/table.sql b/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/inference_log_module/table.sql index f6b4bbe2..e9563229 100644 --- a/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/inference_log_module/table.sql +++ b/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/inference_log_module/table.sql @@ -14,8 +14,6 @@ SELECT "interval", retention, premake, - actor_fk_table_id, - entity_fk_table_id, prefix FROM metaschema_modules_public.inference_log_module WHERE FALSE; diff --git a/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/repository_module/table.sql b/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/repository_module/table.sql index 4f787102..ce892965 100644 --- a/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/repository_module/table.sql +++ b/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/repository_module/table.sql @@ -9,6 +9,6 @@ SELECT id, database_id, schema_id, private_schema_id, proposals_table_id, proposals_table_name, proposal_comments_table_id, proposal_comments_table_name, proposal_reactions_table_id, proposal_reactions_table_name, - has_builds, scope, prefix, entity_table_id, policies, provisions + has_builds, search, scope, prefix, entity_table_id, policies, provisions FROM metaschema_modules_public.repository_module WHERE FALSE; diff --git a/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/storage_log_module/table.sql b/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/storage_log_module/table.sql index 506ae1a9..19ce4ad8 100644 --- a/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/storage_log_module/table.sql +++ b/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/storage_log_module/table.sql @@ -4,7 +4,6 @@ SELECT id, database_id, schema_id, private_schema_id, storage_log_table_id, storage_log_table_name, usage_summary_table_id, usage_summary_table_name, "interval", retention, premake, - actor_fk_table_id, entity_fk_table_id, prefix FROM metaschema_modules_public.storage_log_module WHERE FALSE; diff --git a/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/transfer_log_module/table.sql b/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/transfer_log_module/table.sql index 4760db9f..3c67a12f 100644 --- a/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/transfer_log_module/table.sql +++ b/packages/metaschema-modules/verify/schemas/metaschema_modules_public/tables/transfer_log_module/table.sql @@ -4,7 +4,6 @@ SELECT id, database_id, schema_id, private_schema_id, transfer_log_table_id, transfer_log_table_name, usage_summary_table_id, usage_summary_table_name, "interval", retention, premake, - actor_fk_table_id, entity_fk_table_id, prefix FROM metaschema_modules_public.transfer_log_module WHERE FALSE;