That's weird. The image.id column is declared to be a foreign key to events.is with DELETE CASCADE trigger. If SQLite really supports triggers images should be deleted with referenced events together in one DB request.