Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change actstream models ids type from Char to UUID #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

veerat-pdgt
Copy link

Small Description of change

Change actstream models ids type from Char to UUID

Self tasks

  • Self Reviewed
  • Code is well-commented, linted and follows project conventions

Be kind to code reviewers, please try to keep pull requests as small and focused as possible :)

@@ -24,7 +26,7 @@ class Follow(models.Model):
content_type = models.ForeignKey(
ContentType, on_delete=models.CASCADE, db_index=True
)
object_id = models.CharField(max_length=255, db_index=True)
object_id = models.UUIDField(max_length=255, db_index=True, default=uuid.uuid4)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Vaibhav015 i think we do not need to add default=uuid.uuid4

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, why have we given max_length in uuid field ? I mean do not require this ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per docs, It's recommended to use default in UUIDField @veerat-pdgt
Ref Docs: https://docs.djangoproject.com/en/3.0/ref/models/fields/#uuidfield
cc @vikalpj
Let me know your thoughts @veerat-pdgt @vikalpj 🙂

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vaibhav-pdgt The case mentioned in doc is only applicable when we have PK for uuid. else default should always be based on the usecase. :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, thanks @vikalpj

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes done

@veerat-pdgt
Copy link
Author

Changes LGTM @vaibhav-pdgt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants