Search code examples
python-3.xdjangomulti-tenantdjango-migrationsdjango-tenants

How to run migrations for a specific tenant/schema in Django multi-tenant framework?


The tenant_command was not working properly according to my requirements. So, I found out this solution after tweaking the command below

python3 manage.py tenant_command migrate --schema=schema_name

Solution

  • To run a migration for a specific tenant we just need to specify schema_name for the tenant after the command migrate like --schema=schemaname

    python3 manage.py migrate --schema=schema_name