Create a Unique Attribute

I have this AshPostgres resource and want to make sure the the title is unique. How can I do that?
attributes do
uuid_primary_key :id

attribute :title, :string do
allow_nil? false
end
end
attributes do
uuid_primary_key :id

attribute :title, :string do
allow_nil? false
end
end
3 Replies
Dirigible
Dirigible3y ago
identities do
identity :unique_title, [:title]
end
identities do
identity :unique_title, [:title]
end
you'll need to generate and perform a migration for it to take effect I think
Stefan Wintermeyer
Thank you!

Did you find this page helpful?