Legitimate Uses of the Antipattern
Sometimes you’re forced to use a database brand that doesn’t support foreign key constraints (for example MySQL’s MyISAM storage engine or SQLite prior to version 3.6.19). If that’s the case, then you have to find a way to compensate, like the quality control scripts described in this chapter’s story.
There are also some ultra-flexible database designs where foreign keys can’t model the relationships. It should be a strong clue that you’re using another SQL antipattern if you can’t use traditional referential integrity constraints. For more detail, you may want to look at Chapter 6, Entity-Attribute-Value and Chapter 7, Polymorphic Associations.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access