/* 
 * Copyright (C) 2018 Nauta Tecnològica, SCP - All Rights Reserved.
 * Unauthorized copying, publishing, commercial usage and/or distribution of this file,
 * via any medium, is strictly prohibited without the express permission of the owner.
 */
/**
 * Author:  Jordi Santacana <jordistc@nautalogica.com>
 * Created: 23/05/2018
 */
DROP TRIGGER IF EXISTS trg_%tpl_prefix%proc_delete;
CREATE TRIGGER
	trg_%tpl_prefix%proc_delete
AFTER DELETE ON
	%tpl_prefix%proc
FOR EACH ROW
BEGIN
	DELETE FROM %tpl_prefix%responses
          WHERE proc_id = OLD.id;

	DELETE FROM %tpl_prefix%asyncdata
          WHERE proc_id = OLD.id;

	DELETE FROM %tpl_prefix%task
          WHERE pid = OLD.pid;
END