Changes between Initial Version and Version 2 of Ticket #24110
- Timestamp:
- Jan 10, 2015, 2:04:05 PM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #24110
- Property Summary Related models in migration state are sometimes strings and not models → Unapplying a migration has side-effects on the ProjectState passed to the method
-
Ticket #24110 – Description
initial v2 1 In some edge cases, I think, related models in the migration state are referenced via strings rather than `__fake__` models. This is related to #23745 and 1aa3e09c2043c88a760e8b73fb95dc8f1ffef50e 1 `django.db.migrations.migration.Migration.unapply()` accepts an argument `state` that represents the project state right before the migration is applied. The current implementation alters this state when building the intermediate states to which each operation rolls back, instead of using a copy. This side effect results in errors where e.g. a model can exists in the state, but its gone from the database. 2 2 3 3 {{{#!python … … 29 29 AttributeError: 'str' object has no attribute '_meta' 30 30 }}} 31 32 I've yet to figure out when this is happening exactly.