Skip to content

Fix loaddata

Django dumpdata does not specify the order of fixtures. This way, during loaddata, some relations might be missing the other side.

This is currently happening with:

  • Threads.starting_email <> Email.thread
  • Threads.mailinglist <> Maillist

But it might happen again in the future if dumpdata order changes or if a new relationship is added.

For now, you can migrate a site dumping all apps but hyperkitty and django_mailman3

manage.py dumpdata --exclude hyperkitty --exclude django_mailman3 > django.json
manage.py dumpdata django_mailman3 > django_mailman3.json
manage.py dumpdata hyperkitty > hyperkitty.json

Change your database settings and let it create the tables. Now, import django.json, truncate hyperkitty_profile and django_mailman3_profile tables and then import django_mailman3.json and hyperkitty.json:

manage.py loaddata django.json
sql> truncate table django_mailman3_profile
manage.py loaddata django_mailman3.json
sql> truncate table hyperkitty_profile
manage.py loaddata hyperkitty.json

I'm not sure why *_profile are conflicting but my guess is that it is populating that table on-the-fly while fixtures are being loaded.

Signed-off-by: Luiz Angelo Daros de Luca luizluca@gmail.com

Merge request reports