Using UUIDv7 with Ecto and PostgreSQL

Postgres 18 adds support for generating UUIDv7s out of the box; no extensions required. Unfortunately, it’s less obvious how to use these for the id in our Ecto schemas. But don’t worry, it only requires a few small changes and no new dependencies.

12 Likes

Nice article! TIL about read_after_writes