Using UUIDs With Postgres in Phoenix and Ecto

Setting up Ecto to use UUIDs instead of the regular integer serial IDs with PostgreSQL in Phoenix has always been a hassle, as evident from the numerous blog posts and Stackoverflow questions (1, 2, 3, …). But as of Ecto v2 and Phoenix v1.1, you can pass --binary-id when creating a new Phoenix project to automatically use UUIDs (or other binary IDs when using different databases and adapters).

Continue →