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

deleting a group can cause a constraint error #1336

Closed
mpeck opened this issue Jan 30, 2017 · 1 comment
Closed

deleting a group can cause a constraint error #1336

mpeck opened this issue Jan 30, 2017 · 1 comment
Assignees
Labels

Comments

@mpeck
Copy link
Contributor

mpeck commented Jan 30, 2017

When deleting a group Ecto with sometimes throw a constraint error:

2017-01-30T16:19:53.891 [error] #PID<0.2817.0> running Cog.Endpoint terminated
Server: localhost:4000 (http)
Request: DELETE /v1/groups/589561a5-3391-41f1-91d8-896e8e0f2a62
** (exit) an exception was raised:
    ** (Ecto.ConstraintError) constraint error when attempting to delete struct:

    * foreign_key: user_group_membership_group_id_fkey

If you would like to convert this constraint into an error, please
call foreign_key_constraint/3 in your changeset and define the proper
constraint name. The changeset has not defined any constraint.

        (ecto) lib/ecto/repo/schema.ex:417: anonymous fn/4 in Ecto.Repo.Schema.constraints_to_errors/3
        (elixir) lib/enum.ex:1184: Enum."-map/2-lists^map/1-0-"/2
        (ecto) lib/ecto/repo/schema.ex:403: Ecto.Repo.Schema.constraints_to_errors/3
        (ecto) lib/ecto/repo/schema.ex:347: anonymous fn/9 in Ecto.Repo.Schema.do_delete/4
        (ecto) lib/ecto/repo/schema.ex:608: anonymous fn/3 in Ecto.Repo.Schema.wrap_in_transaction/6
        (ecto) lib/ecto/adapters/sql.ex:480: anonymous fn/3 in Ecto.Adapters.SQL.do_transaction/3
        (db_connection) lib/db_connection.ex:1063: DBConnection.transaction_run/4
        (db_connection) lib/db_connection.ex:987: DBConnection.run_begin/3
@vanstee
Copy link
Member

vanstee commented Jan 30, 2017

We'll need to delete a Changeset rather than a Group struct in the Groups repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants