Add hook to delete queries if their dataset is deleted