macropin / django-registration

Django-registration (redux) provides user registration functionality for Django websites.
http://django-registration-redux.readthedocs.org
Other
975 stars 350 forks source link

I get IntegrityError. Do you have any idea? #416

Closed quroom closed 2 years ago

quroom commented 2 years ago

I changed few times registration framework from django-registration -> django-registration-redux -> django-allauth.

Now I am using django-allauth But I get error like this.. It has some problems related to registration profile table. But I can't see that table in database table. How can I delete user?

django.db.utils.IntegrityError: update or delete on table "profiles_customuser" violates foreign key constraint "registration_registr_user_id_5fcbf725_fk_profiles_" on table "registration_registrationprofile"
DETAIL:  Key (id)=(25) is still referenced from table "registration_registrationprofile".
quroom commented 2 years ago

I got it. I didn't migrate rollback to zero. That's why it reproduce error. And I checked wrong database. So I coudn't find table. What I did is, first python manage.py migrate registration zero. But I got IrreversibleError migrate 0003 to 0002. I read 0003 migration file but it just change some flag to true. I guess It is everything. So I just migrate 0002 --fake And now I did migrate zero It looks working fine. And finally we need to remove permission list for admin page.

Just do Permission.objects.filter(name__icontains="registration").delete() in your django shell.

What do you think my rollback flow? Is there any problem in the future? Please give me advice. I just test it in my local But I need to apply to my realtime product server.

I just leave issue as closed. Because some people might face same situation.