0002-do-not-use-public-schema-for-finding-list-of-migrati.patch
hobo/multitenant/management/commands/migrate_schemas.py | ||
---|---|---|
58 | 58 |
for app in apps.get_app_configs(): |
59 | 59 |
if app.name in settings.TENANT_APPS: |
60 | 60 |
app_labels.append(app.label) |
61 |
loader = MigrationLoader(connection)
|
|
61 |
loader = MigrationLoader(None)
|
|
62 | 62 |
loader.load_disk() |
63 |
recorder = MigrationRecorder(connection) |
|
64 |
applied_public_migrations = set( |
|
65 |
[(app, migration) |
|
66 |
for app, migration in recorder.applied_migrations() |
|
67 |
if app in app_labels and (app, migration) in loader.disk_migrations]) |
|
63 |
all_migrations = set([(app, migration) for app, migration in loader.disk_migrations if app in app_labels]) |
|
68 | 64 |
for tenant in TenantMiddleware.get_tenants(): |
69 | 65 |
connection.set_schema(tenant.schema_name, include_public=False) |
70 | 66 |
applied_migrations = self.get_applied_migrations(app_labels) |
... | ... | |
72 | 68 |
# never skip migrations if explicit migration actions |
73 | 69 |
# are given. |
74 | 70 |
applied_migrations = [] |
75 |
if all([x in applied_migrations for x in applied_public_migrations]):
|
|
71 |
if all([x in applied_migrations for x in all_migrations]):
|
|
76 | 72 |
if int(self.options.get('verbosity', 1)) >= 1: |
77 | 73 |
self._notice("=== Skipping migrations of schema %s" % tenant.schema_name) |
78 | 74 |
continue |
79 |
- |