Solve integrity error duplicate key in Django PostgreSQL


This error caused by we’re using database from copy / clone database. The sequences will be mixed-up.
To solved this, just follow this way :

1
2
python manage.py sqlsequencereset <app-name> > app.sql
psql -U username -d database -a -f < app.sql

Then your problem shall gone!


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.