Can't delete an item that is referenced in another table

I have table A and table B

Table A
-> name: string
Table B
-> a_id: a reference for table A

When I try to delete a row from table A I get a foreign key error because table B contains an entry that references this row id.

How to delete everything?

Have a look at the :on_delete option…