Database logic: Define foreign keys for having constistend data?

This is really DB related. Should I use the built in DB logic from mysql? I mean I could just design my tables without their relation, thats it.

Example: I got a DB with:

so i have my 3 tables and now when I delete a user in table t_user all his referenced rows in t_images assigned to him should also be deleted. So I could do that with DB engine or also with Wappler.

But here comes the problem: As I’m having only a link source to my pictures in t_images with my DB built in system the depending rows would be deleted, but of course not any files or pics in the filesystem. So that means anway I need to handle delete stuff in Wappler. And now comes my point: If I NEED to take care about delete stuff, should I go with these DB relations and foreign keys???

I mean I can set in mysql DB on my table t_user that when a user with ID 423 will be deleted, then his referenced rows in t_images with id 423 will also be “deleted”. (I see options like: this)

@ben I guess you’re the right guy for this. How much you handle ON DB side and how much in Wappler? Whats your best practice before I go with a project? Thanx so much :slight_smile:

Community Page
Last updated: