From 4dc2f7367d67a4f8d976864099db3bc6c9ac76a9 Mon Sep 17 00:00:00 2001 From: Stefan Oderbolz Date: Fri, 26 Jun 2015 17:07:16 +0200 Subject: [PATCH] [#139] Delete package relationships when clearing a harvest source --- ckanext/harvest/logic/action/update.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ckanext/harvest/logic/action/update.py b/ckanext/harvest/logic/action/update.py index 02eae72..36395fb 100644 --- a/ckanext/harvest/logic/action/update.py +++ b/ckanext/harvest/logic/action/update.py @@ -154,6 +154,10 @@ def harvest_source_clear(context,data_dict): delete from package_revision where id in (select id from package where state = 'to_delete'); delete from package_tag where package_id in (select id from package where state = 'to_delete'); delete from package_extra where package_id in (select id from package where state = 'to_delete'); + delete from package_relationship_revision where subject_package_id in (select id from package where state = 'to_delete'); + delete from package_relationship_revision where object_package_id in (select id from package where state = 'to_delete'); + delete from package_relationship where subject_package_id in (select id from package where state = 'to_delete'); + delete from package_relationship where object_package_id in (select id from package where state = 'to_delete'); delete from member where table_id in (select id from package where state = 'to_delete'); delete from related_dataset where dataset_id in (select id from package where state = 'to_delete'); delete from related where id in {related_ids};