Jan 15, 2026
Not every database starts out with cleanly defined foreign key constraints. In grown systems they are often missing, were forgotten during a migration, or got disabled over short term performance concerns. The result is orphaned references, rows that point to long deleted or never existing parent records. This article shows how to systematically find such cases, which repair strategies are realistic, and how to safely add the missing constraint afterward without risking the running system.