Open davenquinn opened 2 years ago
This needs a cascade delete to be applied to both foreign keys in the __analysis_attribute
table.
Once that is done, here are the appropriate queries to run (with arbitrary WHERE clause):
DELETE FROM session
USING sample
WHERE session.sample_id = sample.id
AND lab_id in (
'22-00493','22-00663','22-00665','22-00666','22-00667','22-00668','22-00669','22-00670','22-00671','22-00672'
);
DELETE FROM sample WHERE lab_id in (
'22-00493','22-00663','22-00665','22-00666','22-00667','22-00668','22-00669','22-00670','22-00671','22-00672'
);
Note for documentation: selecting samples you want to delete
-- Get the samples you want to delete
SELECT * FROM sample WHERE lab_id in (
'22-00493','22-00663','22-00665','22-00666','22-00667','22-00668','22-00669','22-00670','22-00671','22-00672'
);
-- Find all associated sessions (just to see how many data piecies we are deleting)
SELECT * FROM session, sample
WHERE session.sample_id = sample.id AND lab_id in (
'22-00493','22-00663','22-00665','22-00666','22-00667','22-00668','22-00669','22-00670','22-00671','22-00672'
);```
The CLI should support deleting samples (with an optional cascade to sessions). Sessions don't need to have a sample attached, so they will have to be deleted in a separate operation.