Skip to content

address mysql utf8mb4 composite index sizes#774

Merged
furlongm merged 1 commit intomainfrom
mysql-issues
Mar 3, 2026
Merged

address mysql utf8mb4 composite index sizes#774
furlongm merged 1 commit intomainfrom
mysql-issues

Conversation

@furlongm
Copy link
Copy Markdown
Owner

@furlongm furlongm commented Mar 3, 2026

closes: #722

Copy link
Copy Markdown
Contributor

@code-review-doctor code-review-doctor bot left a comment

Choose a reason for hiding this comment

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

Looks good. Worth considering though. View full project report here.

class OSRelease(models.Model):

name = models.CharField(max_length=255, unique=True, blank=False, null=False)
name = models.CharField(max_length=128, unique=True, blank=False, null=False)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
name = models.CharField(max_length=128, unique=True, blank=False, null=False)
name = models.CharField(max_length=128, unique=True)

False is the default value Django uses for blank, so blank=False can be removed. Explained here.

Again, redundant default arguments can be removed.

codename = models.CharField(max_length=255, blank=True)
cpe_name = models.CharField(max_length=255, null=True, blank=True, unique=True)
codename = models.CharField(max_length=128, blank=True)
cpe_name = models.CharField(max_length=128, null=True, blank=True, unique=True)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

null=True on a string field causes inconsistent data types because the value can be either str or None. This adds complexity and maybe bugs, but can be solved by replacing null=True with default="". More.

epoch = models.CharField(max_length=255, blank=True, null=True)
version = models.CharField(max_length=255)
release = models.CharField(max_length=255, blank=True, null=True)
epoch = models.CharField(max_length=128, blank=True, null=True)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
epoch = models.CharField(max_length=128, blank=True, null=True)
epoch = models.CharField(max_length=128, blank=True, default='')

null=True on a string field causes inconsistent data types because the value can be either str or None. This adds complexity and maybe bugs, but can be solved by replacing null=True with default="". More details.

release = models.CharField(max_length=255, blank=True, null=True)
epoch = models.CharField(max_length=128, blank=True, null=True)
version = models.CharField(max_length=128)
release = models.CharField(max_length=128, blank=True, null=True)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
release = models.CharField(max_length=128, blank=True, null=True)
release = models.CharField(max_length=128, blank=True, default='')

As above, consider replacing null=True with default="" (and blank=True to pass validation checks).

arch = models.CharField(max_length=255)
name = models.CharField(max_length=128)
version = models.CharField(max_length=128)
epoch = models.CharField(max_length=128, blank=True, null=True)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
epoch = models.CharField(max_length=128, blank=True, null=True)
epoch = models.CharField(max_length=128, blank=True, default='')

As above, consider replacing null=True with default="" (and blank=True to pass validation checks).

name = models.CharField(max_length=128)
version = models.CharField(max_length=128)
epoch = models.CharField(max_length=128, blank=True, null=True)
release = models.CharField(max_length=128, blank=True, null=True)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
release = models.CharField(max_length=128, blank=True, null=True)
release = models.CharField(max_length=128, blank=True, default='')

Again, consider replacing null=True with default="" (and blank=True to pass validation checks).

arch = models.CharField(max_length=128)
packagetype = models.CharField(max_length=1, blank=True, null=True)
category = models.CharField(max_length=255, blank=True, null=True)
category = models.CharField(max_length=128, blank=True, null=True)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
category = models.CharField(max_length=128, blank=True, null=True)
category = models.CharField(max_length=128, blank=True, default='')

Again, consider replacing null=True with default="" (and blank=True to pass validation checks).


score = models.DecimalField(max_digits=3, decimal_places=1, null=True)
severity = models.CharField(max_length=255, blank=True, null=True)
severity = models.CharField(max_length=128, blank=True, null=True)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
severity = models.CharField(max_length=128, blank=True, null=True)
severity = models.CharField(max_length=128, blank=True, default='')

null=True on a string field causes inconsistent data types because the value can be either str or None. This adds complexity and maybe bugs, but can be solved by replacing null=True with default="". More details.

severity = models.CharField(max_length=128, blank=True, null=True)
version = models.DecimalField(max_digits=2, decimal_places=1)
vector_string = models.CharField(max_length=255, blank=True, null=True)
vector_string = models.CharField(max_length=128, blank=True, null=True)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
vector_string = models.CharField(max_length=128, blank=True, null=True)
vector_string = models.CharField(max_length=128, blank=True, default='')

Same as above: consider replacing null=True with default="" (and blank=True to pass validation checks).

@furlongm furlongm merged commit 9c2fdbd into main Mar 3, 2026
4 checks passed
@furlongm furlongm deleted the mysql-issues branch March 3, 2026 01:35
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.

1 participant