AshArcadic.Changes.CreateEdge (AshArcadic v0.1.0)

Copy Markdown View Source

Ash change that persists a graph edge from the action's record to a destination named by an argument, after the vertex write, inside the action's transaction.

change {AshArcadic.Changes.CreateEdge, edge: :author, to: :author_id}

edge: names an edge in the resource's arcade do … end block; to: names an action argument holding the destination PK (or a list → N edges; nil/empty → no edge, action still succeeds). Edge property values come from same-named DECLARED action arguments, serialized by the argument's declared type. multiple? false (default) MERGEs (idempotent); multiple? true CREATEs (parallel edges). A failed or 0-row write returns {:error, _} so Ash rolls the vertex back; DB errors are redacted (Rule 4). The R4 sensitive-property guard fires even on an empty to:.