mailman-web migrate fails with sqlite3.IntegrityError: UNIQUE constraint failed: account_emailaddress.email

Dear Users,
trying to update mailman3 to lastest version, we fail during
mailman-web migrate with:
Operations to perform: Apply all migrations: account, admin, auth, contenttypes, django_mailman3, django_q, hyperkitty, postorius, sessions, sites, socialaccount Running migrations: Applying account.0006_emailaddress_lower...Traceback (most recent call last): File "/opt/mailman/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) File "/opt/mailman/venv/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute return super().execute(query, params) sqlite3.IntegrityError: UNIQUE constraint failed: account_emailaddress.email
We found a workaround to fake the migration with
migrate --fake Operations to perform:
Apply all migrations: account, admin, auth, contenttypes, django_mailman3, django_q, hyperkitty, postorius, sessions, sites, socialaccount
Running migrations:
Applying account.0006_emailaddress_lower... FAKED
Applying account.0007_emailaddress_idx_email... FAKED
Applying account.0008_emailaddress_unique_primary_email_fixup... FAKED
Applying account.0009_emailaddress_unique_primary_email... FAKED
Applying django_q.0015_alter_schedule_schedule_type... FAKED
Applying django_q.0016_schedule_intended_date_kwarg... FAKED
Applying django_q.0017_task_cluster_alter... FAKED
Applying django_q.0018_task_success_index... FAKED
Applying postorius.0019_alter_emailtemplate_data... FAKED
And mailman 3 is still processing mails. I'm unsure if i should recover from snapshot or keep it going?
Could this be some duplicate users with same mail-address?
I have at least spotted one user and delete him.
thank you.
Stefan

On 3/3/25 07:52, Stefan Bauer via Mailman-users wrote:
trying to update mailman3 to lastest version, we fail during
mailman-web migrate with:
Operations to perform: Apply all migrations: account, admin, auth, contenttypes, django_mailman3, django_q, hyperkitty, postorius, sessions, sites, socialaccount Running migrations: Applying account.0006_emailaddress_lower...Traceback (most recent call last): File "/opt/mailman/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) File "/opt/mailman/venv/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute return super().execute(query, params) sqlite3.IntegrityError: UNIQUE constraint failed: account_emailaddress.email
This issue is due to changes in Django allauth to prevent creating multiple addresses differing only in case. The problem is if you have such multiple addresses in your account_emailaddress table, this migration fails. There is a script at https://www.msapiro.net/scripts/UC_fix that will fix this. You may need to adjust the shebang and replace psycopg2 with sqlite3.
See https://github.com/pennersr/django-allauth/issues/3019 perhaps starting at https://github.com/pennersr/django-allauth/issues/3019#issuecomment-17480282...
We found a workaround to fake the migration with
migrate --fake
You should fix the issue with the DB and run the migrations.
Could this be some duplicate users with same mail-address?
This is not related to Mailman users. It is Django users.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (2)
-
Mark Sapiro
-
Stefan Bauer