mirror of https://github.com/django/django.git
Refs #26064 -- Avoided unnecessary list slicing in migration optimizer.
The in_between list is only necessary if an optimization is possible.
This commit is contained in:
parent
a49c2b6bf0
commit
daaa894960
|
@ -45,9 +45,9 @@ class MigrationOptimizer:
|
||||||
right = True # Should we reduce on the right or on the left.
|
right = True # Should we reduce on the right or on the left.
|
||||||
# Compare it to each operation after it
|
# Compare it to each operation after it
|
||||||
for j, other in enumerate(operations[i + 1:]):
|
for j, other in enumerate(operations[i + 1:]):
|
||||||
in_between = operations[i + 1:i + j + 1]
|
|
||||||
result = operation.reduce(other, app_label)
|
result = operation.reduce(other, app_label)
|
||||||
if isinstance(result, list):
|
if isinstance(result, list):
|
||||||
|
in_between = operations[i + 1:i + j + 1]
|
||||||
if right:
|
if right:
|
||||||
new_operations.extend(in_between)
|
new_operations.extend(in_between)
|
||||||
new_operations.extend(result)
|
new_operations.extend(result)
|
||||||
|
|
Loading…
Reference in New Issue