How to solve django.db.utils.IntegrityError?

I am trying to migrate django sqlite database to mysql. So first I dumpdata by running

python manage.py dumpdata > db.json

after that I changed

setting.py

after this I created database at mysql and migrate

python manage.py migrate

and open shell

python manage.py shell

write

from django.contrib.contenttypes.models import ContentType
ContentType.objects.all().delete()

but when I run

python manage.py loaddata db.json

I got error like this 👇👇

MySQLdb._exceptions.IntegrityError: (1062, "Duplicate entry '1-Downloads' for key 'filer_folder.filer_folder_parent_id_name_bc773258_uniq'")
............
.............
............
...........
..........
django.db.utils.IntegrityError: Problem installing fixture '/var/www/html/Planning/SampleTemplate/db.json': Could not load filer.Folder(pk=23): (1062, "Duplicate entry '1-Downloads' for key 'filer_folder.filer_folder_parent_id_name_bc773258_uniq'")
Back to Top