5 ms·
There are ways to prevent invalid states in a database without foreign keys, for example enforcing "all or nothing" operations via transactions.
by Mahn 7y ago
There are ways to prevent invalid states in a database without foreign keys, for example enforcing "all or nothing" operations via transactions.
- Volundr 7y agoUntil a programmer forgets to wrap the new feature in a transaction, or just has a bug in their logic that breaks the integrity. Or a db admin working directly in the database breaks it. Or a schema migration. It's not impossible, sure, but it requires you and everyone working with the data two be very, very disciplined, and is only as effective as the weakest link.