Changes between Initial Version and Version 3 of Ticket #25752
- Timestamp:
- Nov 13, 2015, 10:13:33 AM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #25752
- Property Type Uncategorized → Bug
-
Ticket #25752 – Description
initial v3 1 When in migrations I do RenameField on ManyToMany field, and then do AddField with ManyToMany with same name but different model, I get Integrity Error referring to existing index. 1 Given I have a field 2 2 3 It seems the problem is that RenameField does not rename database indexes, and then when new m2m field is being added it tries to create index with same name and so I get database error: 3 {{{ 4 many = ManyToManyField() 5 }}} 6 7 I create a migration: 8 9 {{{ 10 RenameField: "many" to "many_legacy" 11 Create Field: "many" as ManyToManyField() 12 }}} 13 14 When I run the migration I get: 4 15 5 16 {{{ … … 14 25 }}} 15 26 16 Here is how migration which creates this error looks like: 27 28 It seems the problem is that RenameField does not rename database indexes, and then when new m2m field is being added it tries to create index with same name and so I get database error. 29 30 Here is full migration code which throws this error: 17 31 18 32 {{{