Skip to content

SQL ForeignKeyViolation: ERROR when deleting a Sector type associate to a process #10490

@lawrencemcn

Description

@lawrencemcn

Describe the bug

When as an Admin you try to delete a Sector type already link to a process you have a SQL error displayed.
The error is due to foreign key constraint violation.

To Reproduce

  1. As Admin go to 'Settings'
  2. Create a sector type
  3. Create a sector for the previous sector type
  4. In a process go to the Filters section, check the enable scope
  5. Select a Scope in the scope dropdown list
  6. Select a Scope type in the Scope filter depth dropdown list
  7. Save the Process
  8. Go back to 'Settings'
  9. Try to delete the Scope type you linked to a scope in the previous Process
  10. See error

Expected behavior

The user should be displayed a message that said he can not delete the sector type because it is already link to a process.
The message error text should be in a yml file for translation purpose.
Or when a Scope type is linked to a process the delete button should not be clickable or displayed for this Scope type.

Screenshots

Enabling the Scope and Scope type in a Process
image

Trying to delete the Scope type in the Setting page
image

Confirm delete
image

Error page on try.decidim
image

Stacktrace

The stack trace on local server
image

Extra data

  • Device: Desktop
  • Device OS: Windows 10
  • Browser: Chrome
  • Decidim Version: 0.27.2 and try.decidim.org
  • Decidim installation:

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions