Does backendless support creation of foreign key constraints to enforce relationships between data in different tables?
I would like that the data in the foreign key table is deleted automatically when i delete the parent/related data object.
Unfortunately you can’t manage database structure with any kind of additional keys.
How best can I delete a user with all/selected related objects that were created by the user?
My current approach is retrieving the user with it’s related objects, getting the related objects via getProperty(“related”) and deleting them one by one which I find tedious.
When user is deleted/unregistered all the relations between user and it’s children is destroyed. You don’t have to delete them 1 by 1 if the final goal is deleting the user. Backendless will do it for you. Or I misunderstood smth?
I don’t just want to break the relationship. I want the related objects deleted with the user.
The final goal is deleting the user and all it’s child objects.
Doesn’t the ownerId function as a foreign key? It holds a reference to the parent object from what I gather.
Ah, ok got it!
You can create a beforeRemove event handler for Users table. Execute the necessary logic in handler to minimize in code. But if you want backendless to delete related objects along with user deletion - there is no such possibility implemented yet.
Ok thanks, I have already reached my plan’s cloud code script limit of 3 though, let me see what I can swap this with.
Would you consider increasing the developer plan cloud code script limit to 5?
Hi again, George
Unfortunately such questions are out of my competencies, this a techical support forum. But feel free to forward your question to email@example.com. Mark or someone from sales team will respond ASAP.