I am currently faced with the following problem:
- I have a Person resource
- There are several other resource in the same domain that reference the Person resource via many-to-many and belongs_to relationships
- Occasionally, I find a duplicate Person has been created, meaning there are two Person records, referenced in their own set of relationships, which semantically should be a single record.
- I want to “merge” these two records by deleting one record and designating the other as the "correct” one. All the foreign keys/relationships which involved the deleted record should now point to the remaining “correct record”, if they don’t already exist (set union for many-to-many and overwrite for belongs_to with “correct” id).
Because there are so many relationships and various different resourced involved, my first thought was to use a generic action with reflection on the domain → resources → relationships combined with a to find any relationships which involved a Person and then update them with a strategy defined for each relationship type. What exactly this should look like is unclear to me.
What is the recommended way to do something like this in Ash? Could it make sense to have a generic feature built into Ash to deal with duplicates?






















