migrate_schemas: PEP8ness, remove useless imports (#31042)

This commit is contained in:
Benjamin Dauvergne 2019-03-02 12:19:47 +01:00
parent e869920a9d
commit 2a686e7d34
1 changed files with 4 additions and 6 deletions

View File

@ -1,5 +1,4 @@
import django
from optparse import NO_DEFAULT
from django.apps import apps
from django.core.management.commands.migrate import Command as MigrateCommand
@ -9,7 +8,7 @@ from django.db import connection
from django.conf import settings
from tenant_schemas.utils import get_public_schema_name, schema_exists
from hobo.multitenant.middleware import TenantMiddleware, TenantNotFound
from hobo.multitenant.middleware import TenantMiddleware
from hobo.multitenant.management.commands import SyncCommon
@ -55,10 +54,9 @@ class MigrateSchemasCommand(SyncCommon):
loader.load_disk()
recorder = MigrationRecorder(connection)
applied_public_migrations = set(
[(app, migration) for app, migration
in recorder.applied_migrations()
if app in app_labels and
(app, migration) in loader.disk_migrations])
[(app, migration)
for app, migration in recorder.applied_migrations()
if app in app_labels and (app, migration) in loader.disk_migrations])
for tenant in TenantMiddleware.get_tenants():
connection.set_schema(tenant.schema_name, include_public=False)
applied_migrations = self.get_applied_migrations(app_labels)