How do I make an attribute on a resource unique?

I believe Identities are the way to do it https://ash-hq.org/docs/guides/ash/latest/topics/identities But having trouble finding code examples.
Ash HQ
Guide: Identities
Read the "Identities" guide on Ash HQ
2 Replies
ZachDaniel
ZachDaniel2y ago
identities do
identity :unique_thing, [:thing]
end
identities do
identity :unique_thing, [:thing]
end
that would make :thing unique on the resource if you generate migrations you'll see that it generates a unique constraint (if you're using ash_postgres)
obsidian
obsidianOP2y ago
awesome thanks

Did you find this page helpful?