multitenant: prevent repeating migrations and system checks (#46561)

This commit is contained in:
Benjamin Dauvergne 2020-09-11 09:31:20 +02:00
parent a16f4ce394
commit e311e2611a
2 changed files with 5 additions and 0 deletions

View File

@ -80,6 +80,8 @@ class MigrateSchemasCommand(SyncCommon):
self._notice("=== Running migrate for schema %s" % schema_name)
connection.set_schema(schema_name, include_public=False)
command = MigrateCommand()
command.requires_system_checks = False
command.requires_migrations_checks = False
command.execute(*self.args, **self.options)
connection.set_schema_to_public()

View File

@ -96,6 +96,9 @@ class Command(InteractiveTenantOption, BaseCommand):
else:
klass = load_command_class(app_name, argv[2])
klass.requires_migrations_checks = False
klass.requires_system_checks = False
# Ugly, but works. Delete tenant_command from the argv, parse the schema manually
# and forward the rest of the arguments to the actual command being wrapped.
del argv[1]