Replies: 1 comment 2 replies
-
You can do this slightly more indirectly using identities and calculate :lowercase_name, :string, expr(string_downcase(name)) and then you add it to an identity like so: identity :unique_name_per_artist, [:artist_id, :lowercase_name] and then if you do postgres do
calculations_to_sql [lowercase_name: "LOWER(name)"]
end Someday, |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Another question that came to my mind while I was reading a section about "identities" in "Ash Framework" book :)
I would like to make sure that albums are unique based on
artist_id
andLOWER(name)
columns. I defined a followingcustom_index
for theAlbum
resource:Can I reference that index for the identity instead of defining a separate index there? For example, something like this (sudo code that does not work):
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions