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>
34 lines
2.5 KiB
SQL
34 lines
2.5 KiB
SQL
-- Example Address: operational tables (PostgreSQL 17).
|
|
-- Source: entities/address.md (existence: independent, mutability: reference).
|
|
|
|
CREATE TABLE example_address.address (
|
|
address_id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
address_type text CHECK (address_type IN ('Street Address', 'PO Box', 'Registered Office', 'Overseas Address')), -- enum:Address Type
|
|
address_line_1 text,
|
|
address_line_2 text,
|
|
suburb text,
|
|
city text,
|
|
state_or_region text,
|
|
postcode text,
|
|
country text NOT NULL, -- constraint: Country Required
|
|
created_at timestamptz NOT NULL DEFAULT now(),
|
|
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
CONSTRAINT street_address_requires_address_line_1 -- constraint of the same name in the model
|
|
CHECK (address_type <> 'Street Address' OR address_line_1 IS NOT NULL)
|
|
);
|
|
|
|
COMMENT ON TABLE example_address.address IS 'The canonical record of a physical or postal location. Reference data shared across parties: a single Address record is referenced by all Contact Addresses at that location.';
|
|
COMMENT ON COLUMN example_address.address.address_id IS 'Globally unique surrogate identifier for this physical location record. Immutable once assigned.';
|
|
COMMENT ON COLUMN example_address.address.address_type IS 'The structural type of the address. Determines which fields are applicable.';
|
|
COMMENT ON COLUMN example_address.address.address_line_1 IS 'The primary street address line, typically including street number and street name. For PO Box addresses, the PO Box number.';
|
|
COMMENT ON COLUMN example_address.address.address_line_2 IS 'Secondary address line for suite, level, unit, or building name where applicable.';
|
|
COMMENT ON COLUMN example_address.address.suburb IS 'The suburb or locality component of the address.';
|
|
COMMENT ON COLUMN example_address.address.city IS 'The city or town.';
|
|
COMMENT ON COLUMN example_address.address.state_or_region IS 'The state, territory, or region.';
|
|
COMMENT ON COLUMN example_address.address.postcode IS 'The postal code, stored as a string to preserve leading zeros and support international formats.';
|
|
COMMENT ON COLUMN example_address.address.country IS 'The country in which the address is located, as an ISO 3166-1 alpha-2 country code.';
|
|
|
|
CREATE TRIGGER address_set_updated_at
|
|
BEFORE UPDATE ON example_address.address
|
|
FOR EACH ROW EXECUTE FUNCTION example_address.set_updated_at();
|