Skip to main content

Entity Relationship

Built on develop, not deployed

Derived from model/model.yaml. The product-discovery service is built on develop (IQVO/product-discovery at 9c2f945, checked 2026-10-27) and not deployed (no warehouse-infra entry). Every Err... name, REST route and CloudEvents type on this page exists in the service; where the built service differs from the model's design, the page says so (As built) or the context's Service and operations section lists it.

The schema as built: 0001_product_discovery_schema.up.sql on develop (9c2f945), applied at boot with golang-migrate (which adds its own schema_migrations table). Product Discovery owns its database and shares no table with another context. Extensions: pg_trgm.

4 tables. Key markers: PK primary key, FK foreign key, UK unique. Types are the column types of the migration; constraints (CHECK, defaults, partial indexes) are in the file.

Tables​

TableColumnsPrimary keyRole
products24catalog_item_idaggregate or read-model state
category_view3singletonaggregate or read-model state
listing_items2listing_idaggregate or read-model state
processed_events3event_idinbox: one row per consumed CloudEvents id (dedupe)

Design-time schema versus as built​

The pack was first written with a proposed, fully normalised schema. The service kept the aggregate boundaries and changed the storage shape:

Design-time tableAs built
product_viewsproducts (renamed; bullets, attributes, media and listings are jsonb columns)
listing_rowsproducts.listings (jsonb column) plus listing_items (the ListingItemMap from listingId to item)
category_viewscategory_view (one singleton row, categories as jsonb)

Every other design-time table exists under the same name. The invariants are enforced by the aggregate in internal/domain before a row is written; the migration adds CHECK constraints on scalar columns and the indexes listed in the file.