Releases: elixir-ecto/ecto
Releases · elixir-ecto/ecto
v0.9.0
Enhancements
- Add MySQL support
- Log when migration is already up/down
- Add
Ecto.Association.loaded?/1
- Support joins besides where clauses in
update_all
anddelete_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 passread_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 callingcast/4
. If you are using Phoenix, Phoenix master has aplug :scrub_params, "user"
for that) Ecto.Changeset.cast/4
now expects the changeset/model as first argument and the parameters as secondEcto.Query.distinct/3
can now be specified on queries just onceEcto.Associations
renamed toEcto.Association
(unlikely to affect user code)
Deprecations
- The
:adapter
option should now be specified in the config file rather than when usingEcto.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 fourthEcto.Migration.Reference
now have a default type of:serial
that needs to be translated to the underlying primary key representationEcto.Query
now has adistinct
field (instead ofdistincts
) and its expression may true, false or a list
v0.8.1
v0.8.0
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 parameterslock
expressions now must be a literal string
v0.7.2
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
Enhancements
- Support
after_load/2
andafter_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
andEcto.DateTime
Bug fixes
- Do not accept default, null or primary key options in modify
- Ensure
Ecto.Model.assoc/2
withhas_* :through
has the association as source in from - Properly implement
blank?
forEcto.UUID
andEcto.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
Enhancements
- Provide
Ecto.Adapters.SQL
with implementation to be shared by SQL adapters - Allow
disctinct: selector
in query syntax - Support
has_many :through
andhas_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 toEcto.Adapters.SQL.query/4
Ecto.Adapters.Postgres.begin_test_transaction/2
has been renamed toEcto.Adapters.SQL.begin_test_transaction/2
Ecto.Adapters.Postgres.rollback_test_transaction/2
has been renamed toEcto.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 withEcto.DateTime
,Ecto.Time
andEcto.Date
Ecto.Changeset.validate_change/4
now passes thefield
andvalue
to the callback function instead of only thevalue
v0.6.0
Enhancements
- Pass the repository with the changeset to callbacks
- Add
template
,encoding
,lc_collate
andlc_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 andEcto.Model.Timestamps
- Add
validate_unique/3
toEcto.Changeset
- Support setting
:auto_field
to false inEcto.Schema.belongs_to/3
Bug fixes
- Do not choke on empty
order_by
orgroup_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
v0.5.0
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 onuse Ecto.Repo
and define the repository configuration in theconfig/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
directlyEcto.Schema.schema/2
options were removed in favor of setting@primary_key
and@foreign_key_type
before theschema/2
callEcto.Model.Schema
has been renamed toEcto.Schema
before_insert
,after_insert
,before_update
andafter_update
inEcto.Model.Callbacks
now receive changesets
v0.4.0
Enhancements
- Provide
Ecto.Model.build/2
andEcto.Model.assoc/2
for building and retrieving associations as queries. It is recommended toimport 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
returnsEcto.Associations.NotLoaded
untilpost.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 useRepo.all Ecto.Model.assoc(post, :comments)
. It is recommended toimport Ecto.Model
into your modules join: p.comments
has been removed in favor ofjoin: assoc(p, :comments)
assoc/2
inselect
is deprecated, please useEcto.Query.preload/3
insteadEcto.Associations.Preloader.preload/3
was removed in favor ofRepo.preload/2