Skip to content

Localize SQL version 1.0.0

Choose a tag to compare

@kipcole9 kipcole9 released this 31 Jul 00:20
· 3 commits to main since this release

[1.0.0] - 2026-07-31

Renamed from localize_ecto to localize_sql — the package is about SQL databases (collations, serialization, migrations), not Ecto in general, which can be used without a database. The Localize.Ecto.* module namespace and the mix localize.ecto.audit task are unchanged; the app, config key (:localize_sql), env var (LOCALIZE_SQL_SQLITE_ICU) and priv/localize_sql/ path are renamed.

localize_sql grows from locale-aware collation into the SQL home for every Localize type — serializing the full set of Localize and Elixir data types and generating the tagged-decimal aggregate machinery ex_money_sql builds on.

Added

  • Localize.Ecto.TaggedDecimal and its DDL generate a PostgreSQL composite type with tag-guarded sum/avg/min/max aggregates and +/- operators for any tag-plus-decimal value; a mismatched tag (euros plus yen) raises in the database. ex_money_sql now builds money_with_currency on this rather than its own SQL.

  • Unit serialization, folded in from localize_units_sql: Localize.Unit.Ecto.{Composite,Map}.Type and the Localize.UnitWithUsage variants, Localize.Unit.DDL (now sum/min/max/avg for cldr_unit and cldr_unit_with_usage), and mix localize.unit.gen.migration.

  • Ecto types for the remaining data types: Localize.Currency.Ecto.Type, Localize.LanguageTag.Ecto.Type, Localize.Territory.Ecto.Type and Localize.Script.Ecto.Type (text); Localize.Ecto.Type.IntegerRange and .DateRange (int8range/daterange); Localize.Duration.Ecto.Type and Localize.Ecto.Type.Duration (interval).

  • Localize.Ecto.Range provides query macros for PostgreSQL range columns — containment, overlap, adjacency, the bound accessors and the range aggregates — and Localize.Ecto.Range.Migration creates a time range type, the btree_gist extension and the no_overlap/3 exclusion constraint that forbids overlapping bookings.

  • Localize.Ecto.Migration.Generator renders and writes migrations for the SQL-generating mix tasks.

Fixed

  • Localize.UnitWithUsage.Ecto.Composite.Type.cast/1 now accepts a string-keyed map with no "usage" key, casting it as a unit without a usage. Only the atom-keyed form tolerated the key's absence, so an HTML form — which submits string keys — could not cast a unit unless it also submitted a usage.

Changed

  • Requires localize ~> 1.0. postgrex is an optional dependency; the range, duration and tagged-decimal composite types compile only when it is present, so a SQLite-only or collation-only consumer carries nothing extra.

  • The localize_units_sql package is superseded — its unit serialization is folded in here, and its sum-only aggregates are replaced by sum, min, max and avg for both cldr_unit and cldr_unit_with_usage.