Three names for one show

I had to think back to a college database class and what we learned about primary keys. In the last few years I learned more about UUIDs from outliner apps.

I wanted every TV show tracked across the whole graph. Relationship weights and connections change; the anchor should not. So I made the primary key the tmdb_id, and TVLens never has to renumber its keys after an ingest or a rebuild.

The same stored connection before and after a rebuild, with an auto-increment key and with the tmdb_id as the key

The honest part is that I decided the opposite first. The original record says a key’s durability comes from meaning nothing, because only meaningful keys ever have to change, and that tying the key to an outside service hands them the power to force a rewrite across my database. I still think that is right. I took the trade anyway, and the cost is real: if TMDb ever merges two shows into one id, that is now a key change rather than a column update.

It was good to bring something I learned more than ten years ago into a project I am building now. You can watch a YouTube video on this concept today, but I had to slug it out with Microsoft Access.

For a more in-depth explanation, read this ADR.

← The 80-Day Project