Skip to content

Releases: elixir-ecto/ecto

v1.0.0

25 Aug 11:28
Compare
Choose a tag to compare

Enhancements

  • Support fragment sources in join
  • Also lookup in the changes map for required fields when casting changesets
  • ALlow table and index commands in migration to be pipeable

Bug fixes

  • Ensure constraints errors when saving nested association returns the parent changed and not the child one
  • Ensure rollback only closes innermost transaction
  • Ensure the user changeset containing embeds and assocs is returned when there is a constraint error
  • Ensure binary_ids models can specify unique_constraint for SQL databases

v0.16.0

15 Aug 10:46
Compare
Choose a tag to compare

Enhancements

  • Add functionality for constraint checking in the storage to Ecto.Changeset. Support was added for unique_constraint/3 (powered by unique indexes) and foreign_key_constraint/3, assoc_constraint/3 (belongs to) and no_assoc_constraint/3 (has one/many)
  • Support empty lists as default values
  • Support changing/setting null and default on modify/3 in migrations

Bug fixes

  • Do not generate changes when parameters are :empty even for embeds/associations
  • Raise on bad options in validate_number/3
  • get_field/3 and fetch_field/2 for relations return models
  • Ensure NULL and DEFAULT are respected when defining references

Deprecations

  • Ecto.Changeset.validate_unique/3 is deprecate in favor of Ecto.Changeset.unique_constraint/3. Read the documentation for the latter for more information on updating

Backwards incompatible changes

  • Ecto.Adapters.SQL.query/4 now returns {:ok, result}. Use Ecto.Adapters.SQL.query!/4 for the previous behaviour

Adapter backwards incompatible changes

  • Receive context on Ecto.Adapter.insert/update/delete. Expect context on schema load.

v0.15.0

06 Aug 17:21
Compare
Choose a tag to compare

Enhancements

  • Add query caching
  • Add compare/2 to Ecto.DateTime and friends
  • Add Ecto.Query.API with the purpose of documenting query functions
  • Add Ecto.Migration.rename/3 to rename columns
  • Support changing has_one and has_many via changesets

Deprecations

  • :size option in adapter configuration has been renamed to the more obvious :pool_size

Backwards incompatible change

  • exists?/1 helper in migration has been removed in favor of create_if_not_exists and drop_if_exists
  • rename table(:foo), table(:bar) in migrations has been changed to rename table(:foo), to: table(:bar)
  • Ecto.NoPrimaryKeyError was renamed to Ecto.NoPrimaryKeyFieldError
  • Ecto.MissingPrimaryKeyError was renamed to Ecto.NoPrimaryKeyValueError

v0.14.3

06 Aug 17:22
Compare
Choose a tag to compare

Enhancements

  • Add Ecto.Schema.embedded_schema/0

Bug fixes

  • Multiple bug fixes when working with embeds

v0.14.2

22 Jul 12:13
Compare
Choose a tag to compare

Bug fixes

  • Fix an error where using type/2 in queries was not offsetting parameters properly
  • Do not allow casting of embeds in queries
  • Do not store embed as change if it is on update, it is valid and its changeset has no changes
  • Make sure :any type works correctly with custom types on Ecto.Type.match?/2

v0.14.1

19 Jul 21:44
Compare
Choose a tag to compare

Bug fixes

  • Also tag action in changeset when changeset is invalid

v0.14.0

19 Jul 15:59
Compare
Choose a tag to compare

Experimental features (please try them out and give feedback)

  • Add Ecto.Pools.SojournBroker as a more flexible and customizable alternative to Ecto.Pools.Poolboy
  • Support for embeds_one and embeds_many

Enhancements

  • Add Ecto.Adapters.SQL.to_sql/3
  • Allow preloads to be customized with queries
  • Store the connection PID in Ecto.LogEntry
  • Support :on_delete when defining has_many and belongs_to in schema
  • Allow renaming tables in migration
  • Include Ecto's processing time along side adapter processing on Ecto.LogEntry.query_time
  • Introduce Ecto.Repo.after_connect/1
  • Support date_add/3 and datetime_add/3 for interval based datetime operations
  • Support :push and :pull array operations in Ecto.Repo.update_all/3

Bug fixes

  • Ensure uniqueness validatior runs the proper check when a scope changed but the value is still the same
  • Fix a bug where it was not possible to add a references column in MySQL in an alter table
  • Minimize query rewriting in has_many/one :through, ensuring a wilder variety of associations are supported
  • Do not fail when compiling queries with empty order or group by expressions
  • Ensure literals in queries are also cast/dump

Backwards incompatible changes

  • Ecto.Repo.update!/2 no longer invokes callbacks if there were no changes, avoiding writing to the database at all (use :force to force callback execution)
  • Ecto.Repo.transaction/2 is now flattened. This means that multiple transaction calls will no longer use savepoints, instead it will be considered as a single transaction, where a failure in any transaction block will trigger the outmost transaction to rollback, even if failures are rescued. This should only affect users that were explicitly relying on the savepoints.
  • :date, :time and :datetime were removed in favor of Ecto.Date, Ecto.Time and Ecto.DateTime
  • Ecto.Changeset.errors now return {"shuold be less than %{count}", count: 3} instead of {"shuold be less than %{count}", 3}
  • Ecto.Adapters.SQL.query/4 now returns a list of lists instead of a list of tuples

Adapter backwards incompatible changes

  • Pass {source, model} in Ecto.Adapter.insert/update/delete
  • SQL adapters are not expected to return each row as a list instead of a tuple
  • id_types/0 were removed in favor of load/2 and dump/2

v0.13.1

19 Jul 15:59
Compare
Choose a tag to compare

Bug fixes

  • Allow Ecto.Adapters.SQL.Sandbox to start lazily
  • Fix race conditions in case of crashes in new sandbox pool

v0.13.0

29 Jun 12:50
Compare
Choose a tag to compare

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, []
    

v0.12.1

26 Jun 10:47
Compare
Choose a tag to compare

This release simply contains fixes for adapter compatibility. Check v0.12.0 docs for proper update instructions.