mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-02-16 00:19:32 -06:00
Chore: Optimizes the integer fields for choice types mostly, while leaving plenty of room to grow (#12057)
This commit is contained in:
@@ -0,0 +1,144 @@
|
||||
# Generated by Django 5.2.11 on 2026-02-09 16:37
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("paperless_mail", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="mailaccount",
|
||||
name="account_type",
|
||||
field=models.PositiveSmallIntegerField(
|
||||
choices=[(1, "IMAP"), (2, "Gmail OAuth"), (3, "Outlook OAuth")],
|
||||
default=1,
|
||||
verbose_name="account type",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="mailaccount",
|
||||
name="imap_port",
|
||||
field=models.PositiveIntegerField(
|
||||
blank=True,
|
||||
help_text="This is usually 143 for unencrypted and STARTTLS connections, and 993 for SSL connections.",
|
||||
null=True,
|
||||
verbose_name="IMAP port",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="mailaccount",
|
||||
name="imap_security",
|
||||
field=models.PositiveSmallIntegerField(
|
||||
choices=[(1, "No encryption"), (2, "Use SSL"), (3, "Use STARTTLS")],
|
||||
default=2,
|
||||
verbose_name="IMAP security",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="mailrule",
|
||||
name="action",
|
||||
field=models.PositiveSmallIntegerField(
|
||||
choices=[
|
||||
(1, "Delete"),
|
||||
(2, "Move to specified folder"),
|
||||
(3, "Mark as read, don't process read mails"),
|
||||
(4, "Flag the mail, don't process flagged mails"),
|
||||
(5, "Tag the mail with specified tag, don't process tagged mails"),
|
||||
],
|
||||
default=3,
|
||||
verbose_name="action",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="mailrule",
|
||||
name="assign_correspondent_from",
|
||||
field=models.PositiveSmallIntegerField(
|
||||
choices=[
|
||||
(1, "Do not assign a correspondent"),
|
||||
(2, "Use mail address"),
|
||||
(3, "Use name (or mail address if not available)"),
|
||||
(4, "Use correspondent selected below"),
|
||||
],
|
||||
default=1,
|
||||
verbose_name="assign correspondent from",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="mailrule",
|
||||
name="assign_title_from",
|
||||
field=models.PositiveSmallIntegerField(
|
||||
choices=[
|
||||
(1, "Use subject as title"),
|
||||
(2, "Use attachment filename as title"),
|
||||
(3, "Do not assign title from rule"),
|
||||
],
|
||||
default=1,
|
||||
verbose_name="assign title from",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="mailrule",
|
||||
name="attachment_type",
|
||||
field=models.PositiveSmallIntegerField(
|
||||
choices=[
|
||||
(1, "Only process attachments."),
|
||||
(2, "Process all files, including 'inline' attachments."),
|
||||
],
|
||||
default=1,
|
||||
help_text="Inline attachments include embedded images, so it's best to combine this option with a filename filter.",
|
||||
verbose_name="attachment type",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="mailrule",
|
||||
name="consumption_scope",
|
||||
field=models.PositiveSmallIntegerField(
|
||||
choices=[
|
||||
(1, "Only process attachments."),
|
||||
(
|
||||
2,
|
||||
"Process full Mail (with embedded attachments in file) as .eml",
|
||||
),
|
||||
(
|
||||
3,
|
||||
"Process full Mail (with embedded attachments in file) as .eml + process attachments as separate documents",
|
||||
),
|
||||
],
|
||||
default=1,
|
||||
verbose_name="consumption scope",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="mailrule",
|
||||
name="maximum_age",
|
||||
field=models.PositiveSmallIntegerField(
|
||||
default=30,
|
||||
help_text="Specified in days.",
|
||||
verbose_name="maximum age",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="mailrule",
|
||||
name="order",
|
||||
field=models.SmallIntegerField(default=0, verbose_name="order"),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="mailrule",
|
||||
name="pdf_layout",
|
||||
field=models.PositiveSmallIntegerField(
|
||||
choices=[
|
||||
(0, "System default"),
|
||||
(1, "Text, then HTML"),
|
||||
(2, "HTML, then text"),
|
||||
(3, "HTML only"),
|
||||
(4, "Text only"),
|
||||
],
|
||||
default=0,
|
||||
verbose_name="pdf layout",
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -24,7 +24,7 @@ class MailAccount(document_models.ModelWithOwner):
|
||||
|
||||
imap_server = models.CharField(_("IMAP server"), max_length=256)
|
||||
|
||||
imap_port = models.IntegerField(
|
||||
imap_port = models.PositiveIntegerField(
|
||||
_("IMAP port"),
|
||||
blank=True,
|
||||
null=True,
|
||||
@@ -34,7 +34,7 @@ class MailAccount(document_models.ModelWithOwner):
|
||||
),
|
||||
)
|
||||
|
||||
imap_security = models.PositiveIntegerField(
|
||||
imap_security = models.PositiveSmallIntegerField(
|
||||
_("IMAP security"),
|
||||
choices=ImapSecurity.choices,
|
||||
default=ImapSecurity.SSL,
|
||||
@@ -56,7 +56,7 @@ class MailAccount(document_models.ModelWithOwner):
|
||||
),
|
||||
)
|
||||
|
||||
account_type = models.PositiveIntegerField(
|
||||
account_type = models.PositiveSmallIntegerField(
|
||||
_("account type"),
|
||||
choices=MailAccountType.choices,
|
||||
default=MailAccountType.IMAP,
|
||||
@@ -142,7 +142,7 @@ class MailRule(document_models.ModelWithOwner):
|
||||
|
||||
name = models.CharField(_("name"), max_length=256)
|
||||
|
||||
order = models.IntegerField(_("order"), default=0)
|
||||
order = models.SmallIntegerField(_("order"), default=0)
|
||||
|
||||
account = models.ForeignKey(
|
||||
MailAccount,
|
||||
@@ -215,13 +215,13 @@ class MailRule(document_models.ModelWithOwner):
|
||||
),
|
||||
)
|
||||
|
||||
maximum_age = models.PositiveIntegerField(
|
||||
maximum_age = models.PositiveSmallIntegerField(
|
||||
_("maximum age"),
|
||||
default=30,
|
||||
help_text=_("Specified in days."),
|
||||
)
|
||||
|
||||
attachment_type = models.PositiveIntegerField(
|
||||
attachment_type = models.PositiveSmallIntegerField(
|
||||
_("attachment type"),
|
||||
choices=AttachmentProcessing.choices,
|
||||
default=AttachmentProcessing.ATTACHMENTS_ONLY,
|
||||
@@ -231,19 +231,19 @@ class MailRule(document_models.ModelWithOwner):
|
||||
),
|
||||
)
|
||||
|
||||
consumption_scope = models.PositiveIntegerField(
|
||||
consumption_scope = models.PositiveSmallIntegerField(
|
||||
_("consumption scope"),
|
||||
choices=ConsumptionScope.choices,
|
||||
default=ConsumptionScope.ATTACHMENTS_ONLY,
|
||||
)
|
||||
|
||||
pdf_layout = models.PositiveIntegerField(
|
||||
pdf_layout = models.PositiveSmallIntegerField(
|
||||
_("pdf layout"),
|
||||
choices=PdfLayout.choices,
|
||||
default=PdfLayout.DEFAULT,
|
||||
)
|
||||
|
||||
action = models.PositiveIntegerField(
|
||||
action = models.PositiveSmallIntegerField(
|
||||
_("action"),
|
||||
choices=MailAction.choices,
|
||||
default=MailAction.MARK_READ,
|
||||
@@ -262,7 +262,7 @@ class MailRule(document_models.ModelWithOwner):
|
||||
),
|
||||
)
|
||||
|
||||
assign_title_from = models.PositiveIntegerField(
|
||||
assign_title_from = models.PositiveSmallIntegerField(
|
||||
_("assign title from"),
|
||||
choices=TitleSource.choices,
|
||||
default=TitleSource.FROM_SUBJECT,
|
||||
@@ -282,7 +282,7 @@ class MailRule(document_models.ModelWithOwner):
|
||||
verbose_name=_("assign this document type"),
|
||||
)
|
||||
|
||||
assign_correspondent_from = models.PositiveIntegerField(
|
||||
assign_correspondent_from = models.PositiveSmallIntegerField(
|
||||
_("assign correspondent from"),
|
||||
choices=CorrespondentSource.choices,
|
||||
default=CorrespondentSource.FROM_NOTHING,
|
||||
|
||||
Reference in New Issue
Block a user