`project_compliance_standards_adherence.namespace_id` FK preventing group deletion
Introduced in !122293 (merged), project_compliance_standards_adherence.namespaces_id column is NOT NULL but the foreign key is set to ON DELETE SET NULL which prevents the deletion of some groups (Sentry link).
Error
PG::NotNullViolation: ERROR: null value in column "namespace_id" of relation "project_compliance_standards_adherence" violates not-null constraint (ActiveRecord::NotNullViolation)
Suggestion
We should either change the FK constraint to:
-
ON DELETE CASCADE
and let the cascade deletion handle theproject_compliance_standards_adherence
record deletion. -
ON DELETE RESTRICT
and ensureproject_compliance_standards_adherence
records are deleted before the namespace record in the Projects::DestroyService or Groups::DestroyService.
Edited by Abdul Wadood