DROP TRIGGER IF EXISTS on_delete_article_trigger;

DROP TABLE images;

CREATE TRIGGER on_delete_article_trigger
	BEFORE DELETE ON articles
	BEGIN
		DELETE FROM taggings WHERE taggings.article_id=OLD.article_id;
		DELETE FROM enclosures WHERE enclosures.article_id=OLD.article_id;
		DELETE FROM thumbnails WHERE thumbnails.article_id=OLD.article_id;
	END;