Can't delete child records with trigger on Sequel Pro

261 Views Asked by At

First I want to say I've never tried using triggers before, and I read a lot of information to do this. What I want to do is delete all records from gallery_assets_meta where its parent_id is equal to gallery_assets.id.

This was what I tried on sequel pro:

screenshot

My Sql code:

BEGIN
DELETE FROM gallery_assets_meta
    WHERE gallery_assets_meta.parent_id = old.id;
END

When I try to delete a record from gallery_assets I get this error:

screenshot2

0

There are 0 best solutions below