{{{
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.
Old description:
> 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)]]
New description:
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:
[[Image(https://i.ibb.co/XZYjvYp/hU0HJyqF.jpg)]]
--
--
Ticket URL: <https://code.djangoproject.com/ticket/34151#comment:1>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/34151#comment:2>
* easy: 1 => 0
* stage: Accepted => Unreviewed
Comment:
Thanks for the report. Please don't accept your own tickets.
--
Ticket URL: <https://code.djangoproject.com/ticket/34151#comment:3>