Changes between Initial Version and Version 3 of Ticket #29000


Ignore:
Timestamp:
Jan 9, 2018, 11:19:47 AM (7 years ago)
Author:
David Nelson Adamec
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29000

    • Property Component UncategorizedMigrations
    • Property Type UncategorizedBug
    • Property Version 1.112.0
  • Ticket #29000 – Description

    initial v3  
    22
    33{{{#!python
    4     class ModelA(models.Model):
    5         name_renamed = models.CharField(max_length=10)
     4class ModelA(models.Model):
     5    name_renamed = models.CharField(max_length=10)
    66
    7     class ModelBRenamed(models.Model):
    8         a = models.ForeignKey(ModelA, null=True)
     7class ModelBRenamed(models.Model):
     8    a = models.ForeignKey(ModelA, null=True)
    99
    10     class ModelC(models.Model):
    11         b_set = models.ManyToManyField(ModelBRenamed)
     10class ModelC(models.Model):
     11    b_set = models.ManyToManyField(ModelBRenamed)
    1212}}}
    1313
     
    4949If the two migrations are run together, then the `modelb_id` column in `myapp_modelc_b_set` will not be renamed to `modelbrenamed_id`. However, if I run the migrations one at a time, the column will be renamed as expected.
    5050
    51 I think this is related to #27737. When ModelA is reloaded in the RenameField migration, ModelB is reloaded due to it's foreign key but is missing its relationship to ModelC. When the RenameModel migration is run, ModelC is not included in ModelB's related_objects, so the through table's column is not renamed.
     51I think this is related to #27737. When ModelA is reloaded in the RenameField migration, ModelB is reloaded due to its foreign key but is missing its relationship to ModelC. When the RenameModel migration is run, ModelC is not included in ModelB's related_objects, so the through table's column is not renamed.
    5252
    5353I've reproduced this using Django 1.11 on either MySQL or SQLite.
Back to Top