Dataset deletion should clean its elements first
Sentry Issue: ARKINDEX-BACKEND-1S0
ForeignKeyViolation: update or delete on table "training_dataset" violates foreign key constraint "training_datasetelem_dataset_id_3b1c9bdd_fk_training_" on table "training_datasetelement"
DETAIL: Key (id)=(ca38c593-b556-4ad7-99e9-b4932a03e730) is still referenced from table "training_datasetelement".
File "django/db/backends/base/base.py", line 306, in _commit
return self.connection.commit()
IntegrityError: update or delete on table "training_dataset" violates foreign key constraint "training_datasetelem_dataset_id_3b1c9bdd_fk_training_" on table "training_datasetelement"
DETAIL: Key (id)=(ca38c593-b556-4ad7-99e9-b4932a03e730) is still referenced from table "training_datasetelement".
(10 additional frame(s) were not displayed)
...
File "django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "django/db/backends/base/base.py", line 330, in commit
self._commit()
File "django/db/backends/base/base.py", line 305, in _commit
with self.wrap_database_errors:
File "django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "django/db/backends/base/base.py", line 306, in _commit
return self.connection.commit()