juffel
Posted on February 10, 2023
Today I learned that Ecto.Migration
supports this out of the box ðĨģ
You probably know that you can easily create a unique index like this:
create unique_index("products", [:name], name: :products_lower_name_index)
But did you also know that you can do this also in a case-insensitive way?
According to the docs you can not only provide column names for a new unique index, but also a custom expression.
# Create an index on a custom expression
create unique_index("products", ["(lower(name))"], name: :products_lower_name_index)
ð ðŠ ð
ðĐ
juffel
Posted on February 10, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
elixir Parsing data from CSV into PostgreSQL in Phoenix Framework project with Elixir
December 24, 2023