Three identities: surrogate pk, tmdb_id, slug

Decision 03

A show is identified three times, for three different jobs: an integer pk for foreign keys, a tmdb_id for matching on ingest, and a slug for URLs. One clever identifier serving all three would tie the database’s spine to an external service’s ID.

Context

A show needs identifying in three places: internally for foreign keys, on ingest for matching against TMDb, and publicly in URLs.

The tempting move is one nice identifier doing all three. Something branded, like tvl-{tmdb_id}, reads well in a URL and matches TMDb for free.

Decision

Keep three identifiers, each with one job.

After Action Review

Using the identifier TMDb already assigns, rather than minting one, is what keeps the graph whole. Every show matches on that stable id, so a re-import updates the show already there instead of creating a second copy, and the connections between shows never split across two records of the same title.

← All decisionsRead this record in the tvlens repo →