Skip to content

Releases: elixir-ecto/ecto

v0.9.0

25 Mar 13:45
Compare
Choose a tag to compare

Enhancements

  • Add MySQL support
  • Log when migration is already up/down
  • Add Ecto.Association.loaded?/1
  • Support joins besides where clauses in update_all and delete_all
  • Support optimistic locking with Ecto.Model.OptimisticLock
  • Allow timeout when querying the database to be configured via :timeout
  • Allow timeout when connecting to the database to be configured via :connect_timeout
  • Support maps in select in queries
  • Allow custom macros to be used in queries
  • Support distinct: true that simply sets SELECT DISTINCT

Backwards incompatible changes

  • Primary keys are no longer automatically marked with read_after_writes. If you have a custom primary key that is AUTO INCREMENT/SERIAL in the database, you will have to pass read_after_writes: true as option when setting @primary_key
  • Remove blank checks from Ecto.Changeset.cast/4 (you should automatically set the parameters values to nil before calling cast/4. If you are using Phoenix, Phoenix master has a plug :scrub_params, "user" for that)
  • Ecto.Changeset.cast/4 now expects the changeset/model as first argument and the parameters as second
  • Ecto.Query.distinct/3 can now be specified on queries just once
  • Ecto.Associations renamed to Ecto.Association (unlikely to affect user code)

Deprecations

  • The :adapter option should now be specified in the config file rather than when using Ecto.Repo (you will receive a warning if you don't)

Adapter API changes

  • :time types now use a tuple of four elements (hour, min, sec and msec)
  • Ecto.Adapter.update/6 now expects the fields as third argument and filters as fourth
  • Ecto.Migration.Reference now have a default type of :serial that needs to be translated to the underlying primary key representation
  • Ecto.Query now has a distinct field (instead of distincts) and its expression may true, false or a list

v0.8.1

13 Feb 16:03
Compare
Choose a tag to compare

Bug fixes

  • Ensure in/2 queries on uuid/binary columns work

v0.8.0

12 Feb 19:59
Compare
Choose a tag to compare

Enhancements

  • Allow changesets to be merged with Ecto.Changeset.merge/2
  • Add Ecto.Changeset.put_new_change/3
  • Support the :using option for indexes in Postgres
  • Support adding/dropping indexes concurrently with Postgres
  • Allow expressions to be given as default when adding columns via fragment/1
  • Support integer casting on float types
  • Explicitly checks if adapter supports ddl transactions
  • Log query parameters (this means custom log functions should now expect another element in the query tuple)

Bug fixes

  • Only drop existing indexes when reversing create index
  • Allow boolean literals as defaults when adding columns
  • Add default size to migrations for string columns

Backwards incompatible changes

  • uuid() and <<>> syntax in queries has been removed in favor of explicit parameters
  • lock expressions now must be a literal string

v0.7.2

29 Jan 08:43
Compare
Choose a tag to compare

Enhancements

  • Support Ecto.Query.exclude/2 that resets a previously set query field
  • Support more robust transactional tests via explicit Ecto.Adapters.SQL.restart_test_transaction command

Bug fixes

  • Ensure psql does not require a database with the same name as the user

v0.7.1

27 Jan 15:44
Compare
Choose a tag to compare

Enhancements

  • Support after_load/2 and after_load/3 callbacks
  • Support casting floats and integers in addition to string in Decimal
  • Add __state__ field that to every schema that is either :built, :loaded or :deleted
  • Add Ecto.Changeset.apply/1
  • Support times with miliseconds when casting Ecto.Time and Ecto.DateTime

Bug fixes

  • Do not accept default, null or primary key options in modify
  • Ensure Ecto.Model.assoc/2 with has_* :through has the association as source in from
  • Properly implement blank? for Ecto.UUID and Ecto.DateTime
  • Ensure psql actually works on Windows and does not set locale data by default
  • Make options optional in Ecto.Adapters.SQL.query/4

v0.7.0

25 Jan 11:05
Compare
Choose a tag to compare

Enhancements

  • Provide Ecto.Adapters.SQL with implementation to be shared by SQL adapters
  • Allow disctinct: selector in query syntax
  • Support has_many :through and has_one :through associations. :through can nest any type of association through n-levels
  • Provide type/2 in query syntax for explicitly casting any external value
  • Add Ecto.UUID type that handles UUIDs as strings
  • Add casting support to Ecto.DateTime and related types
  • Allow a map with atom keys or a map with string keys in Ecto.Changeset.cast/4

Bug fixes

  • Fix a limitation where only one nameless join could be given to a query
  • Ensure duplicated preloads are loaded only once
  • Ensure p.field in select returns the proper field type

Backwards incompatible changes

  • Ecto.Adapters.Postgres.query/4 has been renamed to Ecto.Adapters.SQL.query/4
  • Ecto.Adapters.Postgres.begin_test_transaction/2 has been renamed to Ecto.Adapters.SQL.begin_test_transaction/2
  • Ecto.Adapters.Postgres.rollback_test_transaction/2 has been renamed to Ecto.Adapters.SQL.rollback_test_transaction/2
  • Mix tasks now expect the repository with the option -r, otherwise it defaults to the application based one
  • :datetime, :time and :date will now return tuples in Ecto queries. To keep the previous behaviour, please replace the types in your schema with Ecto.DateTime, Ecto.Time and Ecto.Date
  • Ecto.Changeset.validate_change/4 now passes the field and value to the callback function instead of only the value

v0.6.0

17 Jan 10:03
Compare
Choose a tag to compare

Enhancements

  • Pass the repository with the changeset to callbacks
  • Add template, encoding, lc_collate and lc_ctype options to adapter that are used when creating the database
  • Add support for migrations (the previous migration style no longer works, just replace the SQL commands by execute/1 calls)
  • Add support for timestamps via the timestamps/0 macro in schemas and Ecto.Model.Timestamps
  • Add validate_unique/3 to Ecto.Changeset
  • Support setting :auto_field to false in Ecto.Schema.belongs_to/3

Bug fixes

  • Do not choke on empty order_by or group_by during query generation
  • Ensure queries are logged even during crashes

Backwards incompatible changes

  • Previously deprecated validations have been removed
  • Previously deprecated repository configuration has been removed

v0.5.1

13 Jan 19:39
Compare
Choose a tag to compare

Enhancements

  • Add Ecto.Changeset.change/2, Ecto.Changeset.fetch_field/2 and Ecto.Changeset.get_field/2
  • Allow atoms and dynamic values in order_by

Bug fixes

  • Ensure fields in Ecto.Repo.update_all/3 are dumped before being sent to the database

v0.5.0

13 Jan 19:38
Compare
Choose a tag to compare

Enhancements

  • Make Ecto.Schema.schema/2 configuration uniform
  • Add Ecto.Changeset which is able to filter, cast and validate parameters for changes
  • Support custom types via the Ecto.Type behaviour
  • Support read_after_writes configuration for reading particular fields after we insert or update entries in the repository

Bug fixes

  • Require interpolation operator in joins

Deprecations

  • Validations are deprecated in favor of Ecto.Changeset validations
  • def conf in the repository is deprecated, instead pass the :otp_app option on use Ecto.Repo and define the repository configuration in the config/config.exs file. Some features like generators and migrations will be disable until you convert to the new configuration

Backwards incompatible changes

  • @schema_defaults was removed in favor of setting @primary_key and @foreign_key_type directly
  • Ecto.Schema.schema/2 options were removed in favor of setting @primary_key and @foreign_key_type before the schema/2 call
  • Ecto.Model.Schema has been renamed to Ecto.Schema
  • before_insert, after_insert, before_update and after_update in Ecto.Model.Callbacks now receive changesets

v0.4.0

13 Jan 19:38
Compare
Choose a tag to compare

Enhancements

  • Provide Ecto.Model.build/2 and Ecto.Model.assoc/2 for building and retrieving associations as queries. It is recommended to import Ecto.Model into your modules
  • Associations have been rewriten into a simpler and faster mechanism that does not require .get, .all and friends
  • Add Repo.preload/2
  • Ecto.Query.preload/3 now supports query joins to be given
  • Allow dynamic values for join qualifiers and join tables
  • Define a behaviour named Ecto.Associations which defines the callback functions required to be implemented by associations

Backwards incompatible changes

  • Association proxies have been removed. This means post.comments returns Ecto.Associations.NotLoaded until post.comments has been explicitly preloaded. However, once preloaded, the comments list can be accessed directly
  • Queryable implementation for associations has been removed. This means Repo.all post.comments no longer returns all comments. Instead use Repo.all Ecto.Model.assoc(post, :comments). It is recommended to import Ecto.Model into your modules
  • join: p.comments has been removed in favor of join: assoc(p, :comments)
  • assoc/2 in select is deprecated, please use Ecto.Query.preload/3 instead
  • Ecto.Associations.Preloader.preload/3 was removed in favor of Repo.preload/2