Delete orphaned record

Hi all,

I need to delete all related records when I delete a parent ‘thing’ and for the most part this is working fine for me. However, there is one circumstance where I have created a record that doesn’t share a key with a parent record. I appreciate this is probably bad design on my part from the outset but for the moment I am stuck with the situation.

When I delete an ‘aircraft’ in my application there are a bunch of records I want to delete, one of which is an authorisation for what is called a ‘Check A’ . However due to my current design there is always a Check A record that only contains the next techlog number as opposed to a link to a maintenance record. After the deletion therefore I end up with an orphaned record with ‘deleted thing’ in one of its columns.

My question is if Bubble knows a related record has been created and then deleted it obviously knows there is a relationship there somewhere.

How do I use this relationship to delete the ‘blank’ record ? Is this possible?

If not, is there a workflow I can run to find all orphaned records and then delete them?

I appreciate what I should do is redesign part of the application but I can’t do that at the moment.

Thanks

D
Thanks

Am sure all your orphaned records have a thing in common, You can set up a Database worflow to delete all entries/records where that thing is empty,

this will only be feasible if other entries in the DB don’t have thesame field u’re referencing empty.

Thanks - unfortunately valid records will have the same field empty

best way to do it, create a backend database , which delete the ophen things, before for deletion, first search all the childern and create a action schedule api workflow on list chose the workflow for deletion, and pass all the things and then lastly delete the actual thing.

there are many ways to do it

Thanks - the issue is though there is nothing on the record that links it - I will have a rethink.