Skip to content

Commit

Permalink
Fix delete project endpoint (#590)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Franklin <[email protected]>
  • Loading branch information
illusional and illusional authored Jan 2, 2024
1 parent 9668f9e commit 6e4858e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion db/python/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
'assay',
'sequencing_group_assay',
'analysis_sequencing_group',
'analysis_sample',
'assay_external_id',
'sequencing_group_external_id',
'analysis_sequencing_group',
'family',
'family_participant',
'participant_phenotypes',
Expand Down
10 changes: 10 additions & 0 deletions db/python/tables/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,16 @@ async def delete_project_data(
INNER JOIN sample ON sample.id = sg.sample_id
WHERE sample.project = :project
);
DELETE FROM analysis_sample WHERE sample_id in (
SELECT s.id FROM sample s
WHERE s.project = :project
);
DELETE FROM analysis_sequencing_group WHERE analysis_id in (
SELECT id FROM analysis WHERE project = :project
);
DELETE FROM analysis_sample WHERE analysis_id in (
SELECT id FROM analysis WHERE project = :project
);
DELETE FROM assay WHERE sample_id in (SELECT id FROM sample WHERE project = :project);
DELETE FROM sequencing_group WHERE sample_id IN (
SELECT id FROM sample WHERE project = :project
Expand Down

0 comments on commit 6e4858e

Please sign in to comment.