Skip to main content

Entity Relationship

The schema: 0001_pricing_schema.up.sql, embedded in the binary and applied at boot with golang-migrate (which adds its own schema_migrations table). Pricing owns its database and shares no table with another context.

13 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.

Source: internal/adapters/outbound/postgres/migrations/0001_pricing_schema.up.sql.

Tables​

TableColumnsPrimary keyRole
item_prices10catalog_item_idaggregate or read-model state
sale_windows5catalog_item_id, sale_idaggregate or read-model state; FK to item_prices
delivery_charge_schedules4schedule_idaggregate or read-model state
tier_charges5schedule_id, tieraggregate or read-model state; FK to delivery_charge_schedules
tax_tables4tax_table_idaggregate or read-model state
tax_bands4tax_table_id, postal_prefix_fromaggregate or read-model state; FK to tax_tables
price_quotes11quote_idaggregate or read-model state
quote_lines7quote_id, line_noaggregate or read-model state; FK to price_quotes
quote_groups4quote_id, group_noaggregate or read-model state; FK to price_quotes
catalog_items3catalog_item_idaggregate or read-model state
processed_events3event_idinbox: one row per consumed CloudEvents id (dedupe)
idempotency_keys7route, keystored REST answers per Idempotency-Key; the key is global, so route is always the empty string (kept to avoid a migration) and the row commits with the change and its outbox rows; rows older than the 24 h TTL are skipped by every read and purged hourly by the background worker
outbox_events13idtransactional outbox the relay publishes to Kafka