bernardopires / django-tenant-schemas

Tenant support for Django using PostgreSQL schemas.
https://django-tenant-schemas.readthedocs.org/en/latest/
MIT License
1.46k stars 424 forks source link

Populate Tenant Database after tenant creation #597

Open ArvindPanicker opened 5 years ago

ArvindPanicker commented 5 years ago

Hi.

Is there any way to populate the database that has migrations right after tenant creation? I have some fixtures, I would like to load them to that specific schema when the tenant is created.

I used a custom load_schema_data management command and then used the call_command functionality. However that is throwing a tenant not found error.

I even tried with subprocess by writing this in the save of the model of the Tenant after calling it's super, however that results in a connection closed error.

Also tried using the tenant_command using the above two scenarios.