🌲 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).
Currently we've had to override the update function for a few of our modules in CS, because we need to add in the many_to_many or one_to_many associations.
It should be possible to abstract this out into this module, by using
__MODULE__.__schema__(:associations) to get all of the associations, then map through that with __MODULE__.__schema__(:association, assoc) to get detailed information on each association, including whether it's a many_to_many, one_to_many etc, then comparing it with the updated attributes and dealing with any updated associations in the appropriate way.
Currently we've had to override the update function for a few of our modules in CS, because we need to add in the
many_to_many
orone_to_many
associations.It should be possible to abstract this out into this module, by using
__MODULE__.__schema__(:associations)
to get all of the associations, then map through that with__MODULE__.__schema__(:association, assoc)
to get detailed information on each association, including whether it's amany_to_many
,one_to_many
etc, then comparing it with the updated attributes and dealing with any updated associations in the appropriate way.