It's a known issue: https://code.djangoproject.com/ticket/25012.
On Sunday, November 12, 2017 at 12:01:55 AM UTC-5, Liuyang Wan wrote:
-- On Sunday, November 12, 2017 at 12:01:55 AM UTC-5, Liuyang Wan wrote:
Okay, user preference aside. Is this something Django couldn't handle at the moment? If so, it should be submitted as a bug.
On Saturday, November 11, 2017 at 10:22:03 PM UTC+8, mike wrote:i would never try to fight my database and django like that. I would add a separate uuid fieldOn Fri, Nov 10, 2017 at 10:54 PM, Liuyang Wan <tsf...@gmail.com> wrote:Let's say in my Django project I have two models A and B.--class A(models.Model):something...class B(models.Model):a = models.ForeignKey(A)Later on I decided to use uuid as the primary key value. so I update the models:import uuidclass A(models.Model):id = models.UUIDField(db_index=True,default=uuid.uuid4,editable=False)class B(models.Model):id = models.UUIDField(db_index=True,default=uuid.uuid4,editable=False)a = models.ForeignKey(A)Now if I make a migration, Django will NOT pick the changes with the foreign key, i.e the type of fk B.a needs to be updated to uuid as well, not integer anymore.Is this a bug with current version of Django? What is the best practice for handling such case?Thanks,Liuyang
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com .
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users .
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a68ab6ce- .a1c1-42a8-b3d8-82a30edb1079% 40googlegroups.com
For more options, visit https://groups.google.com/d/optout .
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a8473c9c-c33a-47c9-9731-2ce418d6d084%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment