Error while data restoring (database validation)

I’m trying to restore dumped data from one Sentry instance on another one.
The same vesrion (21.3.0), the same config (I’m using Ansible for configuration management).

On the first one dumped data:

docker-compose run --rm -T -e SENTRY_LOG_LEVEL=CRITICAL web export > backup.json

Installed fresh setup, this version, just runned ./install.sh (as described here: https://develop.sentry.dev/self-hosted/backup/)
And restore:

docker-compose run --rm -T -v /srv/sentry/backups/latest:/tmp web import /tmp/backup.json

Getting error:

django.db.utils.IntegrityError: IntegrityError('duplicate key value violates unique constraint "django_content_type_app_label_model_76bd3d3b_uniq"\nDETAIL:  Key (app_label, model)=(sentry, fileblob) already exists.\n',)

And this is predictable, Django is filling up ‘contenttypes’ table from current instance, 'id’s will be different, you shouldn’t use absolute PK (id) in export.

For example with

--natural-primary --exclude=contenttypes

Can I pass these arguments to Django’s

manage.py dumpdata

?

Sorry for the late response. I am quite sure we have addressed this issue in a more recent version: fix(backup): Ignore core apps on export/import by BYK · Pull Request #24460 · getsentry/sentry · GitHub

This should be available in version 21.4.0 and onwards. Can you try with a more recent version?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.