ash-project/ash

Many to many and on match destroy in `manage_relationship`

クローズ

#859 opened on 2024/01/30

 (2 件のコメント) (1 件のリアクション) (0 人の担当者)Elixir (389 件のフォーク)batch import
buggood first issue

Repository metrics

Stars
 (2,412 個のスター)
PR merge metrics
 (平均マージ 6d 6h) (30d で 26 merged PRs)

説明

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.

コントリビューターガイド