Bug Description
When the access to a domain for a user is revoked, the domain still remains in the domain table even if it is not accessed by any other user.
The charm needs to ensure that the domain is also deleted if the domain is not referenced in any other record under DomainUserPermission.
To Reproduce
- Deploy the charm and integrate with Postgres
- Add a user
- Provide access to a domain for the user.
- Revoke access to the domain for the user.
- The domain remains when you log in to the database and list the domain table.
Environment
Version - latest/edge Rev - 56
Relevant log output
httprequest-lego-provider=> select * from api_domain;
id | fqdn
----+-------------------------------
1 | _acme-challenge.example.com
2 | _acme-challenge.example2.com
3 | _acme-challenge.*.example.com
httprequest-lego-provider=> select * from api_domainuserpermission;
id | text | domain_id | user_id
----+------+-----------+---------
1 | | 1 | 1
2 | | 2 | 1
Row 3 in api_domain is a zombie domain.
Additional context
No response
Bug Description
When the access to a domain for a user is revoked, the domain still remains in the domain table even if it is not accessed by any other user.
The charm needs to ensure that the domain is also deleted if the domain is not referenced in any other record under DomainUserPermission.
To Reproduce
Environment
Version - latest/edge Rev - 56
Relevant log output
Additional context
No response