X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=remove_ou_data%2F07_remove_volumes.sql;h=0447e2a39c65fab67cf0e22119243c9369dc5bca;hp=03f875420234d5c4d1c5884bf6e4d2f9c5fd21d2;hb=9e967d7a4207176f0778f0e296ab39d8223eb431;hpb=0cefde660c085b23bc9a6120762ae221cec32bbb diff --git a/remove_ou_data/07_remove_volumes.sql b/remove_ou_data/07_remove_volumes.sql index 03f8754..0447e2a 100644 --- a/remove_ou_data/07_remove_volumes.sql +++ b/remove_ou_data/07_remove_volumes.sql @@ -16,9 +16,11 @@ -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. \set ou_to_del ''''EXAMPLE'''' +\set vol_del_table ORGUNIT_volume_bibs \set ECHO all \timing +DROP TABLE IF EXISTS esi.:vol_del_table; ALTER TABLE asset.call_number DISABLE RULE protect_cn_delete; ALTER TABLE asset.call_number DISABLE TRIGGER audit_asset_call_number_update_trigger; @@ -30,7 +32,7 @@ DELETE FROM asset.uri_call_number_map WHERE call_number IN ( (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del) ); -CREATE TABLE esi.albemarle_volume_bibs AS SELECT DISTINCT record +CREATE TABLE esi.:vol_del_table AS SELECT DISTINCT record FROM asset.call_number WHERE owning_lib IN (SELECT (actor.org_unit_descendants(id)).id from actor.org_unit where shortname = :ou_to_del); @@ -43,4 +45,4 @@ COMMIT; ALTER TABLE asset.call_number ENABLE RULE protect_cn_delete; ALTER TABLE asset.call_number ENABLE TRIGGER audit_asset_call_number_update_trigger; -CREATE INDEX alb_vol_bib_idx ON esi.albemarle_volume_bibs(record); +CREATE INDEX org_vol_bib_idx ON esi.:vol_del_table(record);