#34151: django.db.migrations doesn't update *_id column data type in related 
table
when changing pk type of linked models.
-------------------------------------+-------------------------------------
               Reporter:  STANISLAV  |          Owner:  nobody
  LEPEKHOV                           |
                   Type:  Bug        |         Status:  new
              Component:  Core       |        Version:  4.1
  (Management commands)              |       Keywords:  migrations pk uuid
               Severity:  Normal     |  relation
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  1
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Hello!
 When i changed this models:

 {{{
 class StoreChain(models.Model):
     places = models.ManyToManyField(Place, blank=True)

 class Place(models.Model):
     uid = models.UUIDField(default=uuid.uuid4, editable=False,
 primary_key=True, unique=True)
 }}}

 to this edition (set pk with uuid type):
 {{{
 class StoreChain(models.Model):
     uid = models.UUIDField(default=uuid.uuid4, editable=False,
 primary_key=True, unique=True)
     places = models.ManyToManyField(Place, blank=True)

 class Place(models.Model):
     uid = models.UUIDField(default=uuid.uuid4, editable=False,
 primary_key=True, unique=True)
 }}}

 Django creates a migration file that affects only the model tables, while
 the relationship table remains unchanged, which will cause an error,
 because the data type of the _ID fields in it also needs to be changed:
 [[Image(https://i.ibb.co/XZYjvYp/hU0HJyqF.jpg)]]

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34151>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018466eb88d9-f1b3edde-4f51-4b19-b6ae-8c5b9b101f1f-000000%40eu-central-1.amazonses.com.

Reply via email to