Skip to content

Releases: elixir-ecto/ecto

v3.4.5

28 Jul 19:18
Compare
Choose a tag to compare

Enhancements

  • [Ecto.Changeset] Allow custom error key in unsafe_validate_unique
  • [Ecto.Changeset] Improve performance when casting large params maps

Bug fixes

  • [Ecto.Changeset] Improve error message for invalid cast_assoc
  • [Ecto.Query] Fix inspecting query with fragment CTE
  • [Ecto.Query] Fix inspecting dynamics with aliased bindings
  • [Ecto.Query] Improve error message when selecting a single atom
  • [Ecto.Repo] Reduce data-copying when preloading multiple associations
  • [Ecto.Schema] Do not define a compile-time dependency for schema in :join_through

v2.2.0-rc.1

18 Aug 13:36
Compare
Choose a tag to compare
v2.2.0-rc.1 Pre-release
Pre-release

Regressions

  • [Ecto.UUID] Remove UUID version validation as it is not part of the RFC
  • [Ecto.Adapters.Postgres] No longer add parens to migration index expression in order to support NULL/ASC/DESC

Enhancements

  • [Ecto.Changeset] Add unsafe_validate_unique/3 which validates uniqueness for faster feedback cycles but without data-integrity guarantees
  • [Ecto.Query] Support aggregations in type/2 in select
  • [Ecto.Schema] Support @field_source_mapper in Ecto.Schema as a mechanism to programatically set the :source option

v2.0.1

21 Jun 13:18
Compare
Choose a tag to compare

Bug fixes

  • [Postgres] Ensures the :postgrex application is restarted after running migrations

v2.0.0

21 Jun 13:18
Compare
Choose a tag to compare

Backwards incompatible changes

  • [Changeset] changeset.model has been renamed to changeset.data
  • [Changeset] changeset.optional has been removed
  • [Changeset] changeset.errors now always returns tuple {String.t, Keyword.t} in its values
  • [DateTime] The "Z" (UTC) at the end of an ISO 8601 time has been removed as UTC should not be assumed
  • [LogEntry] Overhaul log entry and store times in :native units
  • [Repo] Ecto.StaleModelError has been renamed to Ecto.StaleEntryError
  • [Repo] Poolboy now expects :pool_overflow option instead of :max_overflow (keep in mind though using such option is discourage altogether as it establishes short-lived connections to the database, likely being worse to performance in both short- and long-term)
  • [Repo] Repo.insert/2 will now send only non-nil fields from the struct to the storage (in previous versions, all fields from the struct were sent to the database)
  • [Repo] Ecto.Pools.Poolboy and Ecto.Pools.SojournBroker have been removed in favor of DBConnection.Poolboy and DBConnection.Sojourn
  • [Repo] :timeout in Repo.transaction now affects the whole transaction block and not only the particular transaction queries
  • [Repo] Overriding Repo.log/1 is no longer supported. Instead provide custom loggers configuration via :loggers. The default is: [Ecto.LogEntry]
  • [Schema] Array fields no longer default to an empty list []. Previous behaviour can be achieved by passing default: [] to the field definition
  • [Schema] __schema__(:types) now returns map
  • [SQL] Ecto.Adapters.SQL.begin_test_transaction, Ecto.Adapters.SQL.restart_test_transaction and Ecto.Adapters.SQL.rollback_test_transaction have been removed in favor of the new ownership-based Ecto.Adapters.SQL.Sandbox

Soft deprecations (no warnings emitted)

  • [Changeset] Deprecate Ecto.Changeset.cast/4 in favor of Ecto.Changeset.cast/3 + Ecto.Changeset.validate_required/3

Deprecations

  • [Changeset] Deprecate :empty in Ecto.Changeset.cast
  • [Repo] Repo.after_connect/1 is deprecated, please pass the :after_connect repository option instead

Enhancements

  • [Adapter] Ensure adapters work on native types, guaranteeing adapters compose better with custom types
  • [Adapter] Support prepared queries in adapters
  • [Adapter] Add support for loading and dumping structures
  • [Changeset] Include the type that failed to cast in changeset errors. Example: [profile: {"is invalid", [type: :map]}]
  • [DateTime] Ensure the given date and datetimes are valid
  • [Migration] Add support for partial indexes by specifying the :where option when on Ecto.Migration.index/2
  • [Migration] Allow the migration table name to be configured in the repository via :migration_source
  • [Migration] Support :on_update for Ecto.Migrate.references
  • [Migration] Use pool of 1 connection for mix ecto.migrate/rollback
  • [Mix] Automatically reenable migration and repository management tasks after execution
  • [Preloader] Support mixing preloads and assocs
  • [Postgres] Add migration and changeset support for PostgreSQL exclusion constraints. Example: create constraint(:sizes, :cannot_overlap, exclude: ~s|gist (int4range("min", "max", '[]') WITH &&)|) and exclusion_constraint(changeset, :sizes, name: :cannot_overlap, message: "must not overlap")
  • [Postgres] Support lateral joins (via fragments)
  • [Postgres] Add migration and changeset support for PostgreSQL check constraints. Example: create constraint(:products, "positive_price", check: "price > 0") and check_constraint(changeset, :price, name: :positive_price, message: "must be greater than zero")
  • [Query] Allow the :on field to be specified with association joins
  • [Query] Support expressions in map keys in select in queries. Example: from p in Post, select: %{p.title => p.visitors}
  • [Query] Support map update syntax. Example: from p in Post, select: %{p | title: "fixed"}
  • [Query] Allow struct fields to be selected with struct/2 and map fields with map/2, including support for dynamic fields
  • [Query] Add first/2 and last/2
  • [Repo] Add Repo.aggregate/4 for easy aggregations
  • [Repo] Allow custom select field in preload queries
  • [Repo] Support the :force option in preloads
  • [Repo] Perform preloads in parallel by default
  • [Repo] Add Repo.in_transaction? to know if the current process is in a transaction
  • [Repo] Support :returning option in insert_all, update_all and delete_all
  • [Schema] Allow @schema_prefix to be configured per schema. It is used for new structs as well as queries where the given schema is used as from
  • [Schema] Support MFA on autogenerate
  • [Schema] Support composite primary keys
  • [Type] Add type {:map, inner_type}

Bug fixes

  • [Changeset] The :required option on cast_assoc and cast_embed will now tag has_many and embeds_many relationships as missing if they contain an empty list
  • [DateTime] Fix Date/DateTime serialization for years above 9999
  • [Postgres] Switch pg storage management away from psql and use direct database connections, solving many issues like locale and database connection
  • [Repo] Ensure nested preload works even if intermediate associations were already loaded
  • [Repo] Do not attempt to execute insert/update/delete statement for associations if a previous operation failed due to a constraint error
  • [Schema] Ensure inserted_at autogeneration runs before updated_at autogeneration

v1.1.8

21 Jun 13:19
Compare
Choose a tag to compare

Enhancements

  • Support Elixir v1.3 calendar types
  • Remove warnings on Elixir v1.3

v1.1.7

21 Jun 13:19
Compare
Choose a tag to compare

Bug fixes

  • Fix bug where ^left in ^right in queries would emit parameters in the wrong order

v1.1.6

21 Jun 13:19
Compare
Choose a tag to compare

Enhancements

  • Also support Poison ~> 2.0

Bug fixes

  • Ensure optimistic_lock reads data from changes
  • Ensure BIT(1) type can be loaded as type :boolean for MYSQL

v1.1.5

19 Apr 10:08
Compare
Choose a tag to compare

Bug fixes

  • Fix Mariaex requirement for 0.5.x and 0.6.x

v1.1.4

19 Apr 10:08
Compare
Choose a tag to compare

Enhancements

  • Support Mariaex 0.5.x and 0.6.x
  • Wrap each pool in a supervisor

v1.1.3

22 Feb 10:46
Compare
Choose a tag to compare

Enhancements

  • Require Postgrex 0.11.0