Skip to content

Multi-Database Tenant Routing

Taxi & Private HireProductsTenancy › Multi-Database Tenant Routing

Generally available

Maps a 3-character tracking-code prefix to the correct tenant database connection. Enables the public tracking endpoint (/p/track/{code}) to resolve a code to a tenant DB before any tenant-scoped query runs. Stored on a separate physical database (go_environment) so the routing table stays available independent of any tenant DB outage.

Fields

FieldTypeDescription
clientId bigint Tenant id this routing row resolves to. Unique via `uniq_client_id` so a single tenant lives in exactly one DB at any time. Mirrored from the tenant's own Client.id but stored here on the routing DB so the lookup survives any per-tenant outage.
clientHash string 3-character routing prefix encoded from `SAFE_ALPHABET` (excludes look-alikes like O/0, I/1). Forms the leading prefix of every public tracking code; `/p/track/{code}` peels the hash, looks up the tenant DB here, then resolves the rest of the code inside that tenant.
databaseHost string Hostname of the tenant's MySQL connection. Defaults to `127.0.0.1` for single-node dev; multi-DB production fills with the actual host so the Doctrine connection factory can route by tenant.
databaseName string Doctrine database / schema name to use for this tenant. Defaults to `go` (single-DB dev); multi-DB production splits tenants across separate database names on the same or different hosts.
createdDate integer Unix timestamp the routing row was first written. Audit-only — once a tenant is registered, the row is effectively read-only outside of host/name updates during DB migrations.