Skip to content

Add lesson 27: UUIDs and domains#86

Merged
exekias merged 1 commit into
mainfrom
lesson/27-uuid-and-domains
Jul 2, 2026
Merged

Add lesson 27: UUIDs and domains#86
exekias merged 1 commit into
mainfrom
lesson/27-uuid-and-domains

Conversation

@exekias

@exekias exekias commented Jul 2, 2026

Copy link
Copy Markdown
Member

Adds the fifth and final lesson of Module 6: Postgres power types — UUIDs and domains (roadmap item 27-uuid-and-domains).

What's in the lesson

  • The uuid type and gen_random_uuid() (core, no extension) as a default primary key
  • UUID vs bigint/serial tradeoffs (uniqueness / unguessability vs 16 bytes and random-insert index locality); UUIDv7 mentioned conceptually
  • Enum types (CREATE TYPE … AS ENUM, ordering, ALTER TYPE … ADD VALUE)
  • Domains: CREATE DOMAIN = a base type + a reusable CHECK (email, positive_int, and a NOT NULL domain) — write the rule once, enforce it everywhere

Seed

A couple of small tables using a uuid PK, an enum column, and domains.

Checks

One schema-state check: accounts.id is of type uuid.

Notes

Includes the byte-identical Module 6 module.yaml.

npm run lessons:validate and next build both pass.

Part of #6

🤖 Generated with Claude Code

Part of #6

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
learn-postgres Ready Ready Preview Jul 2, 2026 9:25am

@exekias exekias merged commit 1ca325f into main Jul 2, 2026
3 checks passed
@exekias exekias deleted the lesson/27-uuid-and-domains branch July 2, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant