X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=remove_ou_data%2F09_remove_bibs_stage_2.sql;fp=remove_ou_data%2F09_remove_bibs_stage_2.sql;h=510ce02671051ebb13f37eeb60e2b581d6c12e9a;hp=86c6e485ee8bb2b33a3d038bd3d6919fae900507;hb=b7e454b73970bda780caf3830ba844ece0379bee;hpb=0c0fb7ed46be05a8e344c141238b63433594fa21 diff --git a/remove_ou_data/09_remove_bibs_stage_2.sql b/remove_ou_data/09_remove_bibs_stage_2.sql index 86c6e48..510ce02 100644 --- a/remove_ou_data/09_remove_bibs_stage_2.sql +++ b/remove_ou_data/09_remove_bibs_stage_2.sql @@ -20,6 +20,8 @@ \set ECHO all \timing +ALTER TABLE biblio.monograph_part DISABLE RULE protect_mono_part_delete; + BEGIN; DELETE FROM authority.bib_linking WHERE bib IN @@ -92,4 +94,19 @@ DELETE FROM booking.resource_type WHERE record IN WHERE NOT EXISTS (select 1 from asset.call_number where record = x.record) ); +DELETE FROM metabib.display_entry WHERE record IN +( + SELECT record FROM esi.:vol_del_table x + WHERE NOT EXISTS (select 1 from asset.call_number where record = x.record) +); + +DELETE FROM metabib.real_full_rec WHERE record IN +( + SELECT record FROM esi.:vol_del_table x + WHERE NOT EXISTS (select 1 from asset.call_number where record = x.record) +); + COMMIT; + + +ALTER TABLE biblio.monograph_part ENABLE RULE protect_mono_part_delete;