Files
semprini-domain-cdp-digital…/canonical-party/ods/010_schema.sql
T
paulandClaude Opus 5 cfb32d2d1b Add Canonical Party as generated in semprini-blog-dataproducts
The canonical data product for the Digital Core domain, copied unchanged from
the blog repository's products/canonical-party (generated by /agent-product
from data_model/data_products/canonical.md, 65 of 65 checks on the blog's
stack on 2026-09-09). The next commit adapts it to the domain platform.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 23:21:27 +12:00

20 lines
802 B
PL/PgSQL

-- Canonical Party: operational data store schema (runs on the postgres service).
--
-- The product owns one PostgreSQL schema. pg_graphql reflects only the schemas on the
-- search_path, and the product's RPC endpoint (030_api.sql) sets the search_path to this
-- schema, so this is what scopes the GraphQL API to the product.
CREATE SCHEMA canonical_party;
COMMENT ON SCHEMA canonical_party IS E'@graphql({"inflect_names": true, "introspection": true, "max_rows": 100})';
-- Maintains updated_at on every row change. Used by all product tables (020_tables.sql).
-- updated_at is the freshness signal carried on the outbound topics and into the lake.
CREATE FUNCTION canonical_party.set_updated_at() RETURNS trigger
LANGUAGE plpgsql AS $$
BEGIN
NEW.updated_at := now();
RETURN NEW;
END
$$;