Releases: elixir-ecto/ecto
v1.0.0
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
Enhancements
- Add functionality for constraint checking in the storage to
Ecto.Changeset
. Support was added forunique_constraint/3
(powered by unique indexes) andforeign_key_constraint/3
,assoc_constraint/3
(belongs to) andno_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
andfetch_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 ofEcto.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}
. UseEcto.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
Enhancements
- Add query caching
- Add
compare/2
toEcto.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
andhas_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 ofcreate_if_not_exists
anddrop_if_exists
rename table(:foo), table(:bar)
in migrations has been changed torename table(:foo), to: table(:bar)
Ecto.NoPrimaryKeyError
was renamed toEcto.NoPrimaryKeyFieldError
Ecto.MissingPrimaryKeyError
was renamed toEcto.NoPrimaryKeyValueError
v0.14.3
v0.14.2
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
v0.14.0
Experimental features (please try them out and give feedback)
- Add
Ecto.Pools.SojournBroker
as a more flexible and customizable alternative toEcto.Pools.Poolboy
- Support for
embeds_one
andembeds_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 defininghas_many
andbelongs_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
anddatetime_add/3
for interval based datetime operations - Support
:push
and:pull
array operations inEcto.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 ofEcto.Date
,Ecto.Time
andEcto.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}
inEcto.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 ofload/2
anddump/2
v0.13.1
v0.13.0
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 usejsonb
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
inEcto.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 usingEcto.Adapters.SQL.Sandbox
for transactional tests. You will have to update your test environment to passpool: Ecto.Adapters.SQL.Sandbox
to the repository configuration -
Ecto.Repo.update_all/3
andEcto.Repo.delete_all/3
now return{counter, nil}
instead of simplycounter
. 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
This release simply contains fixes for adapter compatibility. Check v0.12.0 docs for proper update instructions.