This my database relationship.
I got data like this:
LikeDislike
|-------------|--------------|-----------------|
| id | userId | createdAt |
|-------------|--------------|-----------------|
| 1 | 1 | 2019-03-26 |
|-------------|--------------|-----------------|
RoomLikes
|------------------|--------------|
| likeDislikeId | roomId |
|------------------|--------------|
| 1 | 1 |
|------------------|--------------|
I want to do:
- When I delete a data from
RoomLikes
, likeDELETE FROM roomlikes where id = 1
- The data in
LikeDislike
that related withRoomLikes
will be deleted automatically.
Is there are ways to delete data of parent automatically if data of child was deleted?
Please let me know if you need more info.
Thanks.