awips2/deltaScripts/16.2.1/DR4360/alterNPPSoundingRecordDataURI.sh
2022-05-05 12:34:50 -05:00

32 lines
944 B
Bash
Executable file

#!/bin/bash
# DR #4360 - this update script will alter the dataURI column from tables derived from NPPSoundingRecord.
PSQL="/awips2/psql/bin/psql"
cmdDir=`dirname $0`
source ${cmdDir}/commonFunctions.sh
# table and constraint names from CrimssRecord and NucapsRecord
tables=("nucaps" "crimss")
# columns from NPPSoundingRecord.
cols=("latitude" "longitude")
echo "INFO: Start update of tables derived from NPPSoundingRecord."
for table in ${tables[@]} ; do
if tableExists ${table} ; then
echo "INFO: Start update of ${table} dataURI columns."
for col in ${cols[@]} ; do
echo "INFO: Update ${table}'s ${col}"
echo ${PSQL} -U awips -d metadata -c "DELETE from ${table} where ${col} is NULL ;"
updateNotNullCol ${table} ${col}
done
echo "INFO: ${table} dataURI columns updated successfully"
else
echo "WARNING: The table ${table} does not exist."
fi
done
echo "INFO: Tables derived from NPPSoundingRecord updated."