ash-project/ash

Many to many and on match destroy in `manage_relationship`

Fechada

#859 aberto em 30 de jan. de 2024

 (2 comentários) (1 reação) (0 responsável)Elixir (389 forks)batch import
buggood first issue

Métricas do repositório

Stars
 (2.412 estrelas)
Métricas de merge de PR
 (Mesclagem média 6d 6h) (26 fundiu PRs em 30d)

Description

I think on_match: :destroy in manage_relationship is incorrect for many_to_many.

Right now it destroys a join resource. Instead it should destroy both a join and a destination like other types of relationships do.

If one wants to destroy only a join resource then they should use :unrelate.

Destroy is implemented correctly for on_missing where :destroy destroys both and :unrelate only join one. (Though there is a mistake in documentation that states that it is possible to pass [:join, :keys] with a long form.) That's the only other case with support for :destroy so it is strange that they are inconsistent.

Guia do colaborador