Merge pull request #140 from metaodi/139-delete-package-relationships

[#139] Delete package relationships when clearing a harvest source
This commit is contained in:
David Read 2015-06-26 16:22:37 +01:00
commit ce0aedd5b9
1 changed files with 4 additions and 0 deletions

View File

@ -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_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_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_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 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_dataset where dataset_id in (select id from package where state = 'to_delete');
delete from related where id in {related_ids}; delete from related where id in {related_ids};