diff options
| author | David Wobrock <david.wobrock@gmail.com> | 2020-03-06 13:11:56 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-03-06 13:14:27 +0100 |
| commit | e12fea24f06f8911ddc2af1d6cbfb1adb529c1f2 (patch) | |
| tree | 8a16d91470571be43e72361bb36f3abc79dde06f | |
| parent | 8c1b073b596af23c02020879219b4e85f15a836d (diff) | |
Optimized a bit handle() of sqlmigrate management command.
| -rw-r--r-- | django/core/management/commands/sqlmigrate.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/core/management/commands/sqlmigrate.py b/django/core/management/commands/sqlmigrate.py index f54a594a2c..b75e0a7438 100644 --- a/django/core/management/commands/sqlmigrate.py +++ b/django/core/management/commands/sqlmigrate.py @@ -53,7 +53,7 @@ class Command(BaseCommand): except KeyError: raise CommandError("Cannot find a migration matching '%s' from app '%s'. Is it in INSTALLED_APPS?" % ( migration_name, app_label)) - targets = [(app_label, migration.name)] + target = (app_label, migration.name) # Show begin/end around output for atomic migrations, if the database # supports transactional DDL. @@ -61,7 +61,7 @@ class Command(BaseCommand): # Make a plan that represents just the requested migrations and show SQL # for it - plan = [(executor.loader.graph.nodes[targets[0]], options['backwards'])] + plan = [(executor.loader.graph.nodes[target], options['backwards'])] sql_statements = executor.collect_sql(plan) if not sql_statements and options['verbosity'] >= 1: self.stderr.write('No operations found.') |
