Here I continue on from the last episode (null constraints, etc.) in exploring ways to use an SQL database to ensure data integrity. I'll show ways to avoid shooting yourself in the foot by setting non-existant relationships or by deleting rows that are referenced elsewhere in the database and are therefore necessary. I'll show how to lean on foreign keys to build resource allocation features with practically no backend code. Next I'll demonstrate the perils of relying on uniqueness validations at the Ruby/PHP/Python backend level. Finally I'll show to avoid bloat in pivot tables for many-to-many relationships.
Postgresql Documentation on Constraints - covers uniquness constraints and foreign key constraints
Our screencasts are aimed at intermediate and advanced programmers and focus on:
Mailing list members receive exclusive content as well as episode alerts. Never spam.