IntegrityError: duplicate key value violates unique constraint "corpus_unique_type_slug"
Sentry Issue: ARKINDEX-BACKEND-16E
UniqueViolation: duplicate key value violates unique constraint "corpus_unique_type_slug"
DETAIL: Key (corpus_id, slug)=(dbe8d772-7ca3-43e1-8e46-616413c44776, textline) already exists.
File "django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
IntegrityError: duplicate key value violates unique constraint "corpus_unique_type_slug"
DETAIL: Key (corpus_id, slug)=(dbe8d772-7ca3-43e1-8e46-616413c44776, textline) already exists.
(22 additional frame(s) were not displayed)
...
File "django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
File "django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File "django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
Erwan dixit
et le fix c'est qu'il faut charger les types avec un queryset qui a .using('default') pour utiliser la vraie DB et pas le replica