hex ecto 0.13.0
on Hex

latest releases: 3.11.2, 3.11.1, 3.11.0...
8 years ago

This release adds many important and useful features to Ecto. It also contains three backwards incompatible changes, please read them below.

Enhancements

  • Support a :map type. PostgreSQL will use jsonb columns for those while other SQL databases will emulate it with a text column until JSON support is added
  • Add keyword query fragments: fragment("$set": [foo: "bar"]). This will be useful to databases which cannot express their queries as strings
  • Allow type tagging with field name: select: type(^some_value, p.uuid)
  • Support checking if a value exists in an array: where: "ecto" in p.tags
  • Allow custom options to be given when creating a table: create table(:posts, options: "WITH ...")
  • Support :on_delete in Ecto.Migration.references/2. It may be one of :nothing, :delete_all or :nilify_all. Defaults to :nothing.
  • Add Ecto.Adapter.Pool which will support adpaters to work with different pools (upcoming)
  • Add Ecto.Changeset.validate_subset/4 to validate a list is a subset of the given values
  • Support encoded URLs in the repository configuration

Backwards incompatible changes

  • Ecto.Adapters.SQL now requires using Ecto.Adapters.SQL.Sandbox for transactional tests. You will have to update your test environment to pass pool: Ecto.Adapters.SQL.Sandbox to the repository configuration

  • Ecto.Repo.update_all/3 and Ecto.Repo.delete_all/3 now return {counter, nil} instead of simply counter. This is done to support RETURNING statements in the future.

  • Ecto.Repo.update_all/3 is no longer a macro. Instead of:

    Repo.update_all queryable, foo: "bar"
    

    One should write:

    Repo.update_all queryable, set: [foo: "bar"]
    

    Where :set is the update operator. :inc is also supported to increment a given column by the given value:

    Repo.update_all queryable, inc: [foo: 1]
    

    For complex expressions, updates are now also supported in queries:

    query = from p in Post, update: [set: [foo: p.bar]]
    Repo.update_all query, []
    

Don't miss a new ecto release

NewReleases is sending notifications on new releases.