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

Changeset not capturing constraint on deleting deployment #1707

Open
lawik opened this issue Dec 17, 2024 · 0 comments
Open

Changeset not capturing constraint on deleting deployment #1707

lawik opened this issue Dec 17, 2024 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@lawik
Copy link
Contributor

lawik commented Dec 17, 2024

A customer hit this. You can't delete a deployment if it is used by devices. Fine. But the error needs to be graceful :)

lib/nerves_hub/deployments.ex in NervesHub.Deployments.delete_deployment/1 at line 116
Ecto.ConstraintError
constraint error when attempting to delete struct:

    * "devices_deployment_id_fkey" (foreign_key_constraint)

If you would like to stop this constraint violation from raising an
exception and instead add it as an error to your changeset, please
call `foreign_key_constraint/3` on your changeset with the constraint
`:name` as an option.

The changeset has not defined any constraint.
@lawik lawik added bug Something isn't working good first issue Good for newcomers labels Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant