unicef / iogt

BSD 2-Clause "Simplified" License
25 stars 35 forks source link

Wagtail Transfer content import failed due to integrity error #1708

Closed istride closed 2 weeks ago

istride commented 2 weeks ago

Content import failed from global site to the new site for Cameroon. Error message in the server logs:

django.db.utils.IntegrityError: duplicate key value violates unique constraint "django_content_type_app_label_model_76bd3d3b_uniq"
DETAIL:  Key (app_label, model)=(wagtailadmin, admin) already exists.
istride commented 2 weeks ago

Content types should be expected to be the same across all IoGT sites, though they may not have the same primary key. More recent versions of Wagtail Transfer are set up, by default, to not transfer content types and to use the same fields as the unique constraint (app_label, model).

There should be no harm in configuring Wagtail Transfer to ignore content types, as follows:

WAGTAILTRANSFER_LOOKUP_FIELDS = {
    'contenttypes.contenttype': ['app_label', 'model'],
    ...
}
WAGTAILTRANSFER_NO_FOLLOW_MODELS = [
    'contenttypes.contenttype',
    ...
]