--- /dev/null
+#!/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`."