remove post upgrade script; add script to do it all
authorChris Sharp <csharp@georgialibraries.org>
Wed, 10 Nov 2021 18:33:49 +0000 (13:33 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Wed, 10 Nov 2021 18:33:49 +0000 (13:33 -0500)
Open-ILS/src/sql/Pg/version-upgrade/pines-post-3.8-upgrade.sql [deleted file]
Open-ILS/src/sql/Pg/version-upgrade/run_pines_upgrade.sh [new file with mode: 0755]

diff --git a/Open-ILS/src/sql/Pg/version-upgrade/pines-post-3.8-upgrade.sql b/Open-ILS/src/sql/Pg/version-upgrade/pines-post-3.8-upgrade.sql
deleted file mode 100644 (file)
index 7807ddd..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
--- reingest
-SELECT COUNT(metabib.reingest_record_attributes(bre.id))
-    FROM biblio.record_entry bre
-    JOIN metabib.record_attr_flat mraf ON (bre.id = mraf.id)
-    WHERE deleted IS FALSE
-    AND attr = 'item_type'
-    AND value = 'g';
-
diff --git a/Open-ILS/src/sql/Pg/version-upgrade/run_pines_upgrade.sh b/Open-ILS/src/sql/Pg/version-upgrade/run_pines_upgrade.sh
new file mode 100755 (executable)
index 0000000..7e6c411
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+SCRIPTS="
+3.6.1-3.6.2-upgrade-db.sql
+3.6.2-3.7.0-upgrade-db.sql
+3.6.3-3.6.4-upgrade-db.sql
+3.7.0-3.7.1-upgrade-db.sql
+3.7.1-3.8.0-upgrade-db.sql"
+
+for script in $SCRIPTS; do 
+    echo "Now running $script at `date`"
+    time psql -U evergreen -f /home/gpls/pines/Open-ILS/src/sql/Pg/version-upgrade/$script
+done
+
+echo "Beginning vacuum at `date`"
+PGUSER=evergreen vacuumdb --analyze
+echo "Vacuum completed at `date`"
+
+cd /var/lib/postgresql
+for i in title author subject series identifier keyword; do
+    echo "symspell: Creating $i file at `date`."
+    psql -U evergreen -A -t -o $i -c "select value from metabib.${i}_field_entry where source in (select id from biblio.record_entry where not deleted)"
+    echo "symspell: creating $i.sql file ad `date`."
+    /home/gpls/pines/Open-ILS/src/support-scripts/symspell-sideload.pl $i > $i.sql
+done
+
+psql -U evergreen -c "ALTER TABLE search.symspell_dictionary SET UNLOGGED"
+psql -U evergreen -c "TRUNCATE search.symspell_dictionary"
+
+for i in title author subject series identifier keyword; do
+    echo "inserting $i.sql at `date`"
+    psql -U evergreen -f $i.sql
+done
+
+psql -U evergreen -c "CLUSTER search.symspell_dictionary USING symspell_dictionary_pkey"
+psql -U evergreen -c "REINDEX TABLE search.symspell_dictionary"
+psql -U evergreen -c "ALTER TABLE search.symspell_dictionary SET LOGGED"
+PGUSER=evergreen vacuumdb --analyze --table search.symspell_dictionary
+
+for i in title author subject series identifier keyword; do
+    echo "symspell: dropping search.symspell_dictionary_partial_$i table at `date`"
+    psql -U evergreen -c "DROP TABLE search.symspell_dictionary_partial_$i"
+done
+
+echo "Beginning parallel regingest at `date`"
+# time PGUSER=evergreen PGPASSWORD="youwish" pines/Open-ILS/src/support-scripts/pingest.pl --batch-size 10000 --max-child 8 --skip-browse
+
+echo "Finished PINES 3.8.0 upgrade at `date`."