🌲 alog (Append-only Log) is an easy way to start using the Lambda/Kappa architecture in your Elixir/Phoenix Apps while still using PostgreSQL (with Ecto).
GNU General Public License v2.0
15
stars
2
forks
source link
Adding entry_ids to assocs built with `cast_assoc` #22
If we apply the cast_assoc function to a changeset, the association is added to the changes, and will be inserted into the database if it doesn't exist.
This can cause a problem for us, as the association will be inserted without an entry id.
To fix this, when adding the entry_id on the insert function, we should iterate through the changes, checking if there are any nested changesets, and add entry_ids to those too.
If we apply the
cast_assoc
function to a changeset, the association is added to the changes, and will be inserted into the database if it doesn't exist.This can cause a problem for us, as the association will be inserted without an entry id.
To fix this, when adding the
entry_id
on the insert function, we should iterate through the changes, checking if there are any nested changesets, and addentry_id
s to those too.