I have a multi-tenant django app using django-tenant-schemas.
There is an SiteConfig app:
settings.py:
TENANT_APPS = (
...
'siteconfig',
...
)
INSTALLED_APPS = (
...
'siteconfig',
...
)
But my latest migration on that app won't apply to my tenants:
$ ./manage.py migrate_schemas --shared
[standard:public] === Running migrate for schema public
[standard:public] Operations to perform:
[standard:public] Apply all migrations: account, admin, ... siteconfig, sites, socialaccount, tenant, utilities
[standard:public] Running migrations:
[standard:public] Applying siteconfig.0007_siteconfig_access_code...
[standard:public] OK
As you can see it is only applying the migration to the public schema, and not my tenants.
If I look at my tenant, it shows the migration there as unapplied:
$ ./manage.py tenant_command showmigrations
Enter Tenant Schema ('?' to list schemas): ?
public - localhost
test - test.localhost
Enter Tenant Schema ('?' to list schemas): test
account
[X] 0001_initial
[X] 0002_email_max_length
admin
[X] 0001_initial
[X] 0002_logentry_remove_auto_add+
.
.
.
siteconfig
[X] 0001_initial
[X] 0002_auto_20200402_2201
[X] 0003_auto_20200402_2218
[X] 0004_auto_20200402_2233
[X] 0005_auto_20200403_0947
[X] 0006_auto_20200403_1528
[ ] 0007_siteconfig_access_code # <-- DIDN'T APPLY!
Why is it not applying to the tenant test
and how can I get it to do that?
You are running
manage.py migrate_schemas --shared
Which migrates only public schema
You should run
manage.py migrate_schemas
According to documentation