ash-project/ash

Many to many and on match destroy in `manage_relationship`

已關閉

#859 建立於 2024年1月30日

 (2 則留言) (1 個反應) (0 位負責人)Elixir (389 個分叉)batch import
buggood first issue

倉庫指標

星標
 (2,412 顆星)
PR 合併指標
 (平均合併 6天 6小時) (30 天內合併 26 個 PR)

描述

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.

貢獻者指南