CREATE DEFINER=`jhise`@`localhost` PROCEDURE `delete_project`(in i_project_key char(32))
BEGIN

    declare l_project_id int;

    select id into l_project_id from project where access_key = i_project_key;

	-- permissions_project
    delete from permissions_project where project_id = l_project_id;
    -- project_dataset_jct
    delete from project_dataset_jct where project_id = l_project_id;
    -- project_organization_jct
    delete from project_organization_jct where project_id = l_project_id;
    -- project_keyword_jct
    delete from project_keyword_jct where project_id = l_project_id;
    -- project;
    delete from project where id = l_project_id;
END
