awips2/deltaScripts/14.4.1/DR3091/alter_taf_queue.sh

19 lines
622 B
Bash
Raw Normal View History

2022-05-05 12:34:50 -05:00
#!/bin/bash
# DR #3091 This changes the awips.taf_queue forecasterid column from type integer
# to a varchar converting any values in the table.
PSQL="/awips2/psql/bin/psql"
echo "INFO: Altering awips.taf_queue's forecaster column."
${PSQL} -U awips -d metadata -c "alter table awips.taf_queue alter column forecasterid set data type varchar(255)
using to_char(forecasterid, '000');"
if [ $? -ne 0 ]; then
echo "ERROR: Failed to alter tabelawips.taf_queue's column forecasterid."
echo "FATAL: The update has failed."
exit 1
fi
echo "INFO: awips.taf_queue's forecaster column altered successfully."