LP#1768869 - Update make_release to add auditor table update
authorJosh Stompro <stompro@stompro.org>
Thu, 28 Feb 2019 15:13:58 +0000 (09:13 -0600)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 2 Aug 2019 15:25:27 +0000 (11:25 -0400)
The auditor.update_auditors() function needs to be called
to update tables that are being auditied with schema
changes made to those tables.  This adds a call to that
funcation at the end of the upgrade scripts.

The function seems to not take that long to run, so it may
be ok to run it more than necessary.  Or it can be removed
by release manager if they know that no schema changes were made.

Signed-off-by: Josh Stompro <stompro@stompro.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
build/tools/make_release

index c3fd2ed..1b7b5e1 100755 (executable)
@@ -259,6 +259,11 @@ if [ "$PREV_BRANCH" != "PACKAGE" ]; then
                 cat Open-ILS/src/sql/Pg/upgrade/$NUM.* 2>/dev/null | grep -v '^\s*\(BEGIN\|COMMIT\);\s*$' >> $UPGRADE_FILE
             done;
             echo "COMMIT;" >> $UPGRADE_FILE
+            #Add call to auditor.update_auditors() to keep auditor tables up to date
+            echo "" >> $UPGRADE_FILE
+            echo "-- Update auditor tables to catch changes to source tables." >> $UPGRADE_FILE
+            echo "--   Can be removed/skipped if there were no schema changes." >> $UPGRADE_FILE
+            echo "SELECT auditor.update_auditors();" >> $UPGRADE_FILE
             MAYBE_DUPES=`grep -oP 'CREATE (OR REPLACE )?FUNCTION +\K[^ ]*(?= *\()' $UPGRADE_FILE | sort | grep -P '^(.*)\n\1$' | sort -u`
             if [ -n "$MAYBE_DUPES" ]; then
                 echo ""