Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upsertGraph: allow marking individual models in graph to be unrelated or deleted #14

Merged

Commits on Mar 28, 2023

  1. allow marking individual models in graph to be unrelated or deleted

    with `#unrelate` or `#delete` (prop names configurable with `Model.graphUnrelateProp` and `Model.graphDeleteProp`)
    which override `GraphOptions` i.e. even if `noDelete` or `noUnrelate` is set, specific models marked with those special props can still be unrelated/deleted.
    This allows partial unrelate/deletes to HasMany and ManyToMany relations without the need of passing the whole list of existing models which should be preserved.
    falkenhawk committed Mar 28, 2023
    Configuration menu
    Copy the full SHA
    51cfe27 View commit details
    Browse the repository at this point in the history
  2. avoid NotFoundError when trying to unrelate / delete a model with inv…

    …alid id
    
    `NotFoundError: model (id=x) is not a child of model (id=y). If you want to relate it, use the relate option. If you want to insert it with an id, use the insertMissing option`
    - let upsertGraph ignore those errors when `#delete` or `#unrelate` props are used.
    falkenhawk committed Mar 28, 2023
    Configuration menu
    Copy the full SHA
    26733a8 View commit details
    Browse the repository at this point in the history