Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

[PROPOSAL] Add Support for LOCALE_PROVIDER and ICU_LOCALE

5 views
Skip to first unread message

Salva Ruiz

unread,
Dec 6, 2024, 6:30:09 PM12/6/24
to elixir-ecto

Hi!


I would like to propose a new feature to enhance support for PostgreSQL database creation by allowing users to specify LOCALE_PROVIDER and ICU_LOCALE options when running `mix ecto.create`. This would be particularly useful for users working with ICU-based collations, as ICU provides more advanced and consistent collation rules across platforms compared to the default libc provider.


These options would integrate seamlessly with the existing database configuration in config/dev.exs or other environment-specific files.


```

config :my_app, MyApp.Repo,

  database: "my_database",

  username: "postgres",

  password: "postgres",

  hostname: "localhost",

  locale_provider: "icu",

  icu_locale: "es-ES",

  template: "template0"

```


If implemented, the command: `mix ecto.create` would translate into:


```

CREATE DATABASE my_database

  WITH LOCALE_PROVIDER 'icu' ICU_LOCALE 'es-ES' TEMPLATE 'template0';

```


And the resulting database should be:


```

# \l my_database;


Name              | my_database
Owner             | postgres
Encoding          | UTF8
Locale Provider   | icu
Collate           | en_US.UTF-8
Ctype             | en_US.UTF-8
Locale            | es-ES
ICU Rules         |
Access privileges | 

```


Please let me know if you need additional details or would like assistance in contributing this functionality.


Thank you!





José Valim

unread,
Dec 7, 2024, 3:38:13 AM12/7/24
to elixi...@googlegroups.com
We should definitely support this.  My suggestion is to create a general "create_options: ..." where we nest these inside and we add to the database creation. The existing template, lc_collate, and lc_type should be deprecated and moved there too. A pull request is welcome (you don't need to do the deprecation if you don't want to). :) Thank you!


--
You received this message because you are subscribed to the Google Groups "elixir-ecto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-ecto...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/elixir-ecto/6b210001-e864-4008-ab12-e442416d87een%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages