Proposal for ecto_sql - add :collate to the list of options of Ecto.Migration.add/3

Postgres offers the ability to specify an ICU collation for a text column. This feature is particularly useful if you need a case and accent insensitive column.
Here is an example of how to leverage this feature with raw SQL:

CREATE COLLATION case_accent_insensitive (provider = icu, locale = 'und-u-ks-level1', deterministic = false);

CREATE TABLE users (
    name text COLLATE "case_accent_insensitive"
);

INSERT INTO users (name) VALUES ('José');

SELECT * FROM users WHERE name = 'jose';
name
------
José
(1 row)

Are there plans to add :collate to the list of options of Ecto.Migration.add/3 (and modify/3). If so, I’m willing to contribute.

1 Like