Entylink
Tutorial

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.

uk company verification data model postgrescompany registry schema postgresbusiness verification data modelstore companies house data postgres
Guide details
Read time
11 min
Estimated for an engineer implementing the flow
Level
Advanced
Assumes comfort with APIs and backend basics
Intent
Implementation
Real product or compliance workflows
Who this is for

Start from the real implementation problem

Target readers
Backend engineers designing verification systemsData engineers normalising company and monitoring dataPlatform teams replacing ad hoc JSON storage
01Use company number as the canonical entity key
02Separate current entity state from historical snapshots
03Join verification cases and monitoring subscriptions cleanly
Prerequisites

Keep the setup explicit

01

A Postgres database

02

A workflow that stores company review cases

03

A decision to keep both current state and historical snapshots

Step by step
Step 01

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.

Step 02

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.

Postgres schemaExample
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()
);
Step 03

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.

Step 04

Attach monitoring after approval

Monitoring subscriptions belong to the approved entity set, not to every draft or abandoned onboarding case.