From cfbb0014254e4af63adc6464952ecafdc733d8a7 Mon Sep 17 00:00:00 2001 From: Chris Sharp Date: Mon, 13 Jan 2014 13:31:37 -0500 Subject: [PATCH] Adding PINES datawork to pre-upgrade script. --- .../pines-pre-2.3-2.4.0-upgrade-db.sql | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Open-ILS/src/sql/Pg/version-upgrade/pines-pre-2.3-2.4.0-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/pines-pre-2.3-2.4.0-upgrade-db.sql index c5cbc82bc1..cc22f873dc 100644 --- a/Open-ILS/src/sql/Pg/version-upgrade/pines-pre-2.3-2.4.0-upgrade-db.sql +++ b/Open-ILS/src/sql/Pg/version-upgrade/pines-pre-2.3-2.4.0-upgrade-db.sql @@ -11,4 +11,32 @@ UPDATE config.copy_status SET name = 'Long Overdue (Legacy)' WHERE name = 'Long DROP FUNCTION search.staged_fts(integer,integer,text,integer[],text[],text[],text[],text[],text[],text[],text,real,text,boolean,boolean,boolean,integer,integer,integer); DROP AGGREGATE agg_tsvector(public.tsvector); DROP FUNCTION tsvector_concat(public.tsvector,public.tsvector); + +-- delete empty volumes over 1 month old - real 3m38.936s on test +UPDATE asset.call_number acn SET deleted = TRUE WHERE NOT acn.deleted AND acn.id NOT IN (SELECT acp.call_number FROM asset.copy acp WHERE NOT acp.deleted) AND acn.create_date < (now() - interval '1 month'); + +-- delete empty bibs over 1 month old - real 1m23.544s on test +UPDATE biblio.record_entry bre SET deleted = TRUE WHERE NOT bre.deleted and bre.id NOT IN (SELECT acn.record FROM asset.call_number acn WHERE NOT acn.deleted) AND bre.create_date < (now() - interval '1 month'); + +-- delete Missing items over one year old +UPDATE asset.copy SET deleted = TRUE WHERE NOT deleted AND status IN (SELECT id FROM config.copy_status WHERE name = 'Missing') AND edit_date <= (now() - interval '1 year'); + +-- delete the circ modifiers that never seem to actually go away... +UPDATE asset.copy SET circ_modifier = 'bestseller' WHERE circ_modifier = 'bestsellernh'; +UPDATE asset.copy SET circ_modifier = 'av' WHERE circ_modifier IN ('filmstrip', 'new-av'); +UPDATE asset.copy SET circ_modifier = NULL WHERE circ_modifier IN ('computer', 'internet', 'internethg', 'internethm'); + +DELETE FROM config.circ_matrix_matchpoint WHERE circ_modifier IN ('bestsellernh', 'filmstrip', 'new-av', 'computer', 'internet'); +DELETE FROM config.hold_matrix_matchpoint WHERE circ_modifier IN ('bestsellernh', 'filmstrip', 'new-av', 'computer', 'internet'); + +DELETE FROM config.circ_modifier WHERE code IN ('bestsellernh', 'filmstrip', 'new-av', 'computer', 'internet', 'internethg', 'internethm'); + +VACUUM ANALYZE asset.call_number; +VACUUM ANALYZE biblio.record_entry; +VACUUM ANALYZE asset.copy; +VACUUM ANALYZE config.circ_matrix_matchpoint; +VACUUM ANALYZE config.hold_matrix_matchpoint; +VACUUM ANALYZE config.circ_modifier; +VACUUM ANALYZE config.copy_status; + COMMIT; -- 2.11.0