Change-Id: Ide533d105f8a02cf88fdeb25970b99a5c6399eb2 Former-commit-id: c00e44bcae398aaa2af21d8be2e133eba41b94ff
28 lines
No EOL
841 B
Bash
Executable file
28 lines
No EOL
841 B
Bash
Executable file
#!/bin/bash
|
|
# DR #4360 - this update script will alter the dataURI columns for tables derived from AbstractWarningRecord
|
|
|
|
PSQL="/awips2/psql/bin/psql"
|
|
|
|
cmdDir=`dirname $0`
|
|
|
|
source ${cmdDir}/commonFunctions.sh
|
|
tables=("practicewarning" "warning")
|
|
nullCols=("wmoid" "pil" "xxxid" "act" "etn" "phensig")
|
|
|
|
# table and constraint names from AbstractWarningRecord.
|
|
|
|
for table in ${tables[@]} ; do
|
|
echo "INFO: Start update of ${table} dataURI columns."
|
|
|
|
for col in ${nullCols[@]} ; do
|
|
echo "INFO: Update ${table}' ${col}"
|
|
${PSQL} -U awips -d metadata -c "UPDATE ${table} SET ${col}='' where ${col} is NULL ; "
|
|
updateNotNullCol ${table} ${col}
|
|
done
|
|
|
|
col=seg
|
|
${PSQL} -U awips -d metadata -c "DELETE from ${table} where ${col} is NULL ; "
|
|
updateNotNullCol ${table} ${col}
|
|
|
|
echo "INFO: ${table} dataURI columns updated successfully"
|
|
done |