References on UUID issue: is invalid

I think you need to add @foreign_key_type :binary_id to your schema.

https://hexdocs.pm/ecto/Ecto.Schema.html#module-redacting-fields

On a somewhat related note, I migrated my project from using UUIDs back to normal bigint, and transforming the ids when interacting with web or other interfaces. It’s something you may consider.

The main drawback of working with UUIDs, is that it makes life much harder when debugging your data.

3 Likes