Changes between Initial Version and Version 1 of Ticket #26180, comment 2


Ignore:
Timestamp:
Jul 17, 2016, 5:38:27 AM (8 years ago)
Author:
Akshesh Doshi

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #26180, comment 2

    initial v1  
    11This is happening because the `RemoveField` operation is called before calling the `AlterUniqueTogether` operation, resulting in the dropping of the field before the index.
    22
    3 In the `autodetector.py`, although the `RemoveField` operations are created before the `AlterUniqueTogether` operations but the [https://github.com/django/django/blob/20d39325ca1da57a709f3ba38299dc7b0fc4bdfb/django/db/migrations/autodetector.py#L188 `_sort_migrations` method] corrects the order of these operations to bring `AlterUniqueTogether` before `RemoveField`. But the [https://github.com/django/django/blob/20d39325ca1da57a709f3ba38299dc7b0fc4bdfb/django/db/migrations/autodetector.py#L190 `_optimize_migrations` method] again reverses this order in `self.migrations` (which is finally what gets returned by the `_detect_changes` method.
     3In the `autodetector.py`, although the `RemoveField` operations are created before the `AlterUniqueTogether` operations but the [https://github.com/django/django/blob/20d39325ca1da57a709f3ba38299dc7b0fc4bdfb/django/db/migrations/autodetector.py#L188 `_sort_migrations` method] corrects the order of these operations to bring `AlterUniqueTogether` before `RemoveField`. But the [https://github.com/django/django/blob/20d39325ca1da57a709f3ba38299dc7b0fc4bdfb/django/db/migrations/autodetector.py#L190 `_optimize_migrations` method] again reverses this order in `self.migrations` (which is finally what is returned by the `_detect_changes` method) with no optimization as such.
    44
    5 This change is related to https://github.com/django/django/commit/e470f311d654267ec86f9a6325ec500345b9dff2
     5This change is somewhat related to https://github.com/django/django/commit/e470f311d654267ec86f9a6325ec500345b9dff2
Back to Top