Files
semprini-data-product-templ…/canonical_data_product/ods/010_schema.sql
T
paulandClaude Opus 5 62a3714562 Add the canonical data product template
Moves the data product template from semprini-blog-dataproducts, as adapted to
the semprini-data domain platform, into canonical_data_product/. Its worked
example passed 9 of 9 checks on the domain platform on 2026-09-17.

Adds agent-canonical-product, the blog's agent-product adapted to generate a
product into a domain repository from a declaration in the domain's model
repository, and README/CLAUDE.md describing the template catalogue, the
product contract with the domain platform, and team ownership. Source-aligned
and experience templates are planned.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 22:55:11 +12:00

20 lines
812 B
PL/PgSQL

-- {{product.name}}: 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 {{product.schema}};
COMMENT ON SCHEMA {{product.schema}} 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 {{product.schema}}.set_updated_at() RETURNS trigger
LANGUAGE plpgsql AS $$
BEGIN
NEW.updated_at := now();
RETURN NEW;
END
$$;