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

Increase length of fields in Profile model #311

Merged
merged 3 commits into from
Nov 16, 2023

Conversation

Lvyshnevska
Copy link
Collaborator

Length of specified fields in Profile model increased:
name - to 100 characters;
common_info - to 2000 characters.

@Lvyshnevska Lvyshnevska added this to the Sprint 7 milestone Nov 15, 2023
@Lvyshnevska Lvyshnevska self-assigned this Nov 15, 2023
@Lvyshnevska Lvyshnevska linked an issue Nov 15, 2023 that may be closed by this pull request
@@ -65,7 +65,7 @@ class Profile(models.Model):
region = models.CharField(
max_length=128, choices=Region.choices, default=None, null=True
)
common_info = models.CharField(max_length=255, default=None, null=True)
common_info = models.CharField(max_length=2000, default=None, null=True)
Copy link

Choose a reason for hiding this comment

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

For texts > 255 chars I'd recommend to use models.TextField(validators=[MaxLengthValidator(2000)], null=True).

CharField translates into varchar PostgreSQL data type, which is fixed length, i.e. each row in the table will take 2k of disk space, even if the field is empty or contains just a couple of chars. TextField translates in dynamic-width data type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.
Thanks.

@Lvyshnevska Lvyshnevska merged commit f25be5a into develop Nov 16, 2023
4 checks passed
@Lvyshnevska Lvyshnevska deleted the #310-IncreaseLengthOfFieldsInProfileModel branch November 16, 2023 12:25
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.

Increase length of fields in Profile model
3 participants