Need advice an DB design


I would need advices or feedbacks on DB design.

Let’s imagine I have 2 things, thingA and thingB.

thingA contains a field that is a list of thingB.

When a thingA is deleted, I’d need all linked thingB to be deleted.

What I was going to do is to add a field in the thingB, referencing the linked thingA. So that upon deletion, I would delete the thingA element, then any thingB element with the referencing field set to the thingA element.

Not sure that’s the best way to proceed (several delete calls to perform).

So… Is there any other preferable way to delete a thing + any linked thing?

Many thanks for your feedback!

Also looking for a solution for this right now. Like thingB is a sub data type of thingA correct?

Yes, correct.

Also, each thingB item has one and only one “father” (thingA item)

In the Workflow, first use Delete List of Things on ThingA’s list, and then delete ThingA. If the list of things is more than 100, you might need to use a recursive workflow to delete the items of the list.

1 Like

Alternatively, you can run Delete List of Things on Do a Search for Thing B with constraint ThingA’s list contains ThingB (inverse linking).

1 Like

Many thanks @deadpoetnsp, very appreciated! :+1:t2::pray:t2:

So no need to add a field in thingB data structure referencing the linking thingA! :+1:t2:

That’s right. But it may still be helpful (at least in the testing/debugging stage) and then later if it all works as intended you can remove the link to ThingA

1 Like

Good point, I will let them during the staging phase.

I asked this question because I also was afraid to degrade my app performances, using too much links between things (except the native one using the list of things field). What is crystal clear, it’s that I don’t need such additional links between things to be able to delete a thing and it’s “sub things”, and that’s great, and good to know.

I also know that I could have found the answer by myself, as the delete list of things is available as a Workflow action… So sorry for the question, and again, many thanks for your clear answer and recommendation!

1 Like

The more questions, the better, because that makes us all think and learn :slight_smile:


This topic was automatically closed after 70 days. New replies are no longer allowed.