From 6b8daacd6c90e0b52384e64e545574162207e5b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9lestin=20Matte?= <dev@cmatte.me>
Date: Mon, 22 Sep 2025 21:00:50 +0200
Subject: [PATCH] Increase listsubscriber username field length

This field is populated by pglister_sync, copying information from
auth_user.username, which can be up to 150 characters.
---
 .../0005_alter_listsubscriber_username.py      | 18 ++++++++++++++++++
 django/archives/mailarchives/models.py         |  2 +-
 2 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100644 django/archives/mailarchives/migrations/0005_alter_listsubscriber_username.py

diff --git a/django/archives/mailarchives/migrations/0005_alter_listsubscriber_username.py b/django/archives/mailarchives/migrations/0005_alter_listsubscriber_username.py
new file mode 100644
index 0000000..752cbd6
--- /dev/null
+++ b/django/archives/mailarchives/migrations/0005_alter_listsubscriber_username.py
@@ -0,0 +1,18 @@
+# Generated by Django 5.2.6 on 2025-09-22 18:39
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ("mailarchives", "0004_resend_rate_limit"),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name="listsubscriber",
+            name="username",
+            field=models.CharField(max_length=150),
+        ),
+    ]
diff --git a/django/archives/mailarchives/models.py b/django/archives/mailarchives/models.py
index 44c4469..5362a98 100644
--- a/django/archives/mailarchives/models.py
+++ b/django/archives/mailarchives/models.py
@@ -122,7 +122,7 @@ class ListSubscriber(models.Model):
     # We set the username of the community account instead of a
     # foreign key, because the user might not exist.
     list = models.ForeignKey(List, null=False, blank=False, on_delete=models.CASCADE)
-    username = models.CharField(max_length=30, null=False, blank=False)
+    username = models.CharField(max_length=150, null=False, blank=False)
 
     class Meta:
         unique_together = (('list', 'username'), )
-- 
2.51.0

