Changes between Initial Version and Version 1 of Ticket #27121
- Timestamp:
- Aug 24, 2016, 6:56:38 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #27121
- Property Component Database layer (models, ORM) → Migrations
- Property Resolution → duplicate
- Property Status new → closed
-
Ticket #27121 – Description
initial v1 1 1 I discovered a bug that causes a migration to fail when a column is deleted in a migration and unique together is modified in the same migration. The following are the steps to reproduce the bug: 2 2 {{{ 3 3 # Consider this your model: 4 4 class Fruit (models.Model): … … 9 9 class Meta: 10 10 unique_together = ('taste', 'color', 'shape') 11 11 }}} 12 12 Now, if you delete the field 'shape' and remove it from the unique together in the same migration so the model looks as follows: 13 13 {{{ 14 14 # Updated model: 15 15 class Fruit (models.Model): … … 19 19 class Meta: 20 20 unique_together = ('taste', 'color') 21 21 }} 22 22 Migration will fail in modifying the unique_together and throw an error that the Fruit has no field named 'shape' I think that this is because the delete of the column is processed before the unique index is updated. 23