Model UK company verification data in Postgres without losing registry history
Design a Postgres schema for UK company verification workflows using company numbers as stable keys, snapshots for registry history, and separate monitoring subscriptions for approved entities.
Start from the real implementation problem
Keep the setup explicit
A Postgres database
A workflow that stores company review cases
A decision to keep both current state and historical snapshots
Keep the company number as your primary external key
Do not generate your own unstable identifier for the registry entity. The Companies House number should anchor the company record and every downstream relationship.
Separate current state from snapshots
Store the latest normalized entity state in one table and append raw or semi-normalized snapshots in another. That gives you operational speed and auditability at the same time.
create table companies ( company_number text primary key, company_name text not null, company_status text, jurisdiction text, last_synced_at timestamptz not null default now() ); create table company_snapshots ( id bigserial primary key, company_number text not null references companies(company_number), snapshot_type text not null, payload jsonb not null, captured_at timestamptz not null default now() ); create table monitoring_subscriptions ( id bigserial primary key, company_number text not null references companies(company_number), entylink_webhook_id text not null, is_active boolean not null default true, created_at timestamptz not null default now() );
Store verification cases separately from entities
A business can be reviewed multiple times. Keep the case model separate from the entity model so you can capture who reviewed what and when without duplicating the company record.
Attach monitoring after approval
Monitoring subscriptions belong to the approved entity set, not to every draft or abandoned onboarding case.