django-tenants: delete tenants with queryset method doesn't delete their schemas
The model delete method works properly, but if you call the queryset method nothing happens to the schemas.
These are the models related to tenants in the project that I’m having the issue:
class Client(TenantMixin):
name = models.CharField(max_length=100)
created_on = models.DateField(auto_now_add=True)
# default true, schema will be automatically created and synced when it is saved
auto_drop_schema = True
auto_create_schema = True
class Domain(DomainMixin):
pass
This in the code I’m using to reproduce the issue:
clients = Client.objects.all()
for c in clients:
c.delete() # this deletes the tenant model and the schema
Client.objects.all().delete() # this deletes only the tenant model, not the schema
OBS.: Also tried setting AUTO_DROP_SCHEMA in django settings, but it also didn’t work.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 18 (12 by maintainers)
Commits related to this issue
- fixed #179 thanks to scardine/django-tenants — committed to django-tenants/django-tenants by tomturner 6 years ago
Thanks for mentioning, I totally forgot about this. It should be a small patch, will try to get it done this weekend.
Has anyone been able to delete the eschemas automatically? I am in Django 2.x and it also does not work, I delete a Client but Schema remains.
@pauloscardine do you have this fix on a public repo anywhere? If not, we are going to take stab at it an PR.