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

DELETE Tenant - Foreign Key Constraint #6310

Closed
satkunas opened this issue Apr 21, 2021 · 4 comments
Closed

DELETE Tenant - Foreign Key Constraint #6310

satkunas opened this issue Apr 21, 2021 · 4 comments

Comments

@satkunas
Copy link
Contributor

Describe the bug
DELETE /api/v1/tenant/:produces foreign key constraint error in person table

To Reproduce
Steps to reproduce the behavior:

  1. Create a new Tenant
  2. Delete new tenant
  3. Inspect packetfence.log
  4. See error

Additional context

Apr 21 09:36:29 packetfence packetfence: pfperl-api(2813) ERROR: Database query failed with non retryable error: Cannot delete or update a parent row: a foreign key constraint fails (`pf`.`person`, CONSTRAINT `person_tenant_id` FOREIGN KEY (`tenant_id`) REFERENCES `tenant` (`id`)) (errno: 1451) [DELETE FROM `tenant` WHERE ( `tenant`.`id` = ? )]{2} (pf::dal::db_execute)
@nqb
Copy link
Contributor

nqb commented Apr 22, 2021

Perl unit tests failed: https://gitlab.com/inverse-inc/packetfence/-/jobs/1201417909#L559.

Related to #6239

@jrouzierinverse
Copy link
Member

What should be the expected behavior when you attempt to remove a tenant that still has resource tied to it?

@extrafu
Copy link
Member

extrafu commented Jul 20, 2021

@satkunas Hide the button for now. We'll handle that cleanly later.

@extrafu
Copy link
Member

extrafu commented Oct 13, 2021

For now - if no data is tied to a tenant, we delete it. If there is, we disable it.

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

No branches or pull requests

4 participants