TLDR Web Dev · ARTICLES & TUTORIALS

LIFE ALTERING POSTGRESQL PATTERNS

mccue.dev12 min read

Summary from the TLDR Web Dev newsletter

This article goes over a few important PostgreSQL patterns. For example, it recommends using UUID primary keys as the tradeoffs are usually worth it. Also, `created_at` and `updated_at` timestamps should always be automatically added in tables and `on update restrict on delete restrict` for foreign key constraints should always be set. Enum tables should be used for controlled values, tables should be named singularly, and soft deletes should be used instead of real, hard deletes.