Opened 2 years ago
Last modified 12 months ago
#34151 assigned Bug
django.db.migrations doesn't update *_id column data type in related table when changing pk type of linked models. — at Version 1
Description (last modified by ) ¶
Hello!
When i changed this models:
class StoreChain(models.Model): places = models.ManyToManyField(Place, blank=True) class Place(models.Model): pass
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:
According to the ticket's flags, the next step(s) to move this issue forward are:
- To provide a patch by sending a pull request. Claim the ticket when you start working so that someone else doesn't duplicate effort. Before sending a pull request, review your work against the patch review checklist. Check the "Has patch" flag on the ticket after sending a pull request and include a link to the pull request in the ticket comment when making that update. The usual format is:
[https://github.com/django/django/pull/#### PR]
.
Note:
See TracTickets
for help on using tickets.