Your comment table probably still has answers with isReply values โโreferring to comments that were removed during testing. Listen to what MySQL is trying to say:
a foreign key constraint fails
All you have to do is clear the table, define the foreign key (your error should disappear), and then you will have the required behavior. After creating an FK, there is no need for triggers, so there are cascades.
Note that you probably want to set the default value for isReply to null using:
ALTER TABLE comments CHANGE isReply isReply integer DEFAULT NULL;
source share