How to Get Foreign Keys Horribly Wrong
Constraints keep the integrity of your system and prevent you from shooting yourself in the foot. Foreign keys are a special type of constraint because, unlike unique, check, and primary keys, they span more than one relation. This makes foreign keys harder to enforce and harder to get right. In this article, I demonstrate common pitfalls, potential optimizations, and implicit behavior related to foreign keys. Table of Contents Watch 📺 This article is inspired by a talk I gave at DjangoCon EU