On 6/15/24 11:47, Jörg Schulz wrote:
After updating to the most recent version of mailman-web, the migrations script issued an error:
Apply all migrations: account, admin, auth, contenttypes, django_mailman3, django_q, hyperkitty, postorius, sessions, sites, socialaccount mailman-web | Running migrations: mailman-web | Traceback (most recent call last): mailman-web | File "/usr/lib/python3.12/site-packages/django/db/backends/utils.py", line 89, in _execute mailman-web | return self.cursor.execute(sql, params) mailman-web | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mailman-web | psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "account_emailaddress_user_id_email_987c8728_uniq" mailman-web | DETAIL: Key (user_id, email)=(27, John.Doe@mynicedomain.de) already exists. mailman-web |(...)
Presumably you upgraded django-allauth to a version >=0.62. Beginnin then, email addresses were no longer stored case-sensitively and the migration was dealing with that.
There were other issues when addresses were store case sensitively. See https://github.com/pennersr/django-allauth/issues/3019
Digging into the db, I found the duplicate to result from a duplicate entry using john.doe@mynicedomain.de
Obviously, the process that originally created the entry, took case sensitivity literally which doesn't seem to be the case any longer for the migration script.
I fixed this by removing one of the duplicates hoping no further errors will come up....
What would have been the better approach?
Removing one of the duplicates is the solution, and beginning with django-allauth>=0.62, duplicates should no longer occur.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan