So I am upgrading a quite old Django application to one of the latest version of Django. And one of the problem I am facing is it uses a third party package, django-uuidfield, to store uuid value in one of the model. But now that library is not maintained and also Django has it’s own UUIDField so I was thinking to upgrade that uuid field and use the Django’s built-in UUIDField. But there are couple of problems that I am facing and would love to get some ideas/hints/guidance on how to tackle those.
# old code
uuid = uuidfield.UUIDField(version=1, hyphenate=True, unique=True, db_index=True)
# new code
uuid = models.UUIDField(default=uuid.uuid4, editable=False, unique=True)
-
So I uninstalled the old package the application was using which broke the old migration file for that field as it was using that package when the migration was created. Any ideas on what would be the best way to tackle this, currently I commented out the code in migration file which was using that package.
-
The new code created new migrations but I am not able to migrate these migrations as it says
uuid column for this model already exists
, and also while doing this how do I make sure that the old data of that field is migrated to the new one.