4 ms·
I don't see it this way. Foreign keys in your database allow you do define relationships that must be maintained across your data set. Without them it's possibl
by sehrope 13y ago
I don't see it this way. Foreign keys in your database allow you do define relationships that must be maintained across your data set. Without them it's possible for a bug in your application code to create a logical state that makes no sense (ex: child records with no parent).
Just like data type checks (ex: regex whitelisting for field values) they need to be done at both the front end and backed and yes some times it's a pain but in the long run that's a positive not a negative. If you expose your database to a whole new app, say v2 of your app or an orthogonal admin interface, you can be assured of relational guarantees between your tables.