Ash-Postgres and uuidv7
This might be an Ecto question. If I add a Postgres function uuidv7(), can Ash use it when creating new resource instances? If not, could Ash use such a function in Elixir (that would probably be faster anyway).
4 Replies
You can create a custom type and configure the migration default for the attributes in resources so it gets set in the db (although ash will always set it in application logic if it’s got a default).
attribute :id, YourUUID, primary_key?: true, default: &YourUUID.generate/0
I think something along those linesAwesome! Thank you!
FYI.. uuidv7 support in Elixir https://github.com/bitwalker/uniq
GitHub
GitHub - bitwalker/uniq: Provides UUID generation, parsing, and for...
Provides UUID generation, parsing, and formatting. Supports RFC 4122, and the v6 draft extension - GitHub - bitwalker/uniq: Provides UUID generation, parsing, and formatting. Supports RFC 4122, and...
Medium
Analyzing New Unique Identifier Formats (UUIDv6, UUIDv7, and UUIDv8)
A dive into the new proposed UUID versions. What do they offer and how do they work.