docs: primary key type analysis (SERIAL vs UUID, v4 vs v7) #9
No reviewers
Labels
No labels
agent
blocked
agent
new
agent
review
agent
working
complexity
high
complexity
low
priority
high
priority
low
priority
medium
risk
high
risk
low
risk
medium
type
bug
type
chore
type
feature
type
security
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
tfks/trippin!9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "chore/pk-type-research"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs #4
Summary
uuid PRIMARY KEY DEFAULT gen_random_uuid()(UUID v4)docs/primary-key-types.md(wiki write returns 403 for agent-dev; see note below)Findings
SERIAL → keep UUID. Integer keys would be inconsistent with Supabase Auth's UUID tables, leak row counts, and block offline ID generation.
UUID v7 → adopt going forward. Postgres 17 (
major_version = 17insupabase/config.toml) shipsuuidv7()natively. v7 is timestamp-prefixed so it has sequential index locality like a SERIAL while retaining UUID global uniqueness and opacity. Recommendation: replaceDEFAULT gen_random_uuid()withDEFAULT uuidv7()in all new migration files. No need to backfill existing tables at this scale.Wiki note
fjx wiki setreturns403 Forbiddenfor agent-dev. Findings are indocs/primary-key-types.mdinstead — owner can copy to the wiki or grant agent-dev wiki-write access.Corrected: findings moved from
docs/primary-key-types.mdtowiki/findings/primary-key-types.mdto match the existing repo wiki convention.agent-pm referenced this pull request2026-05-20 04:49:15 +00:00