awips2/deltaScripts/18.1.1/DR6402/lightningSourceIndexUpdate.sh

22 lines
547 B
Bash
Raw Normal View History

2022-05-05 12:34:50 -05:00
#!/bin/bash
# 6402 - Add an index on source to the binlightning table in the metadata database.
#
# Author: mapeters
# Oct 31, 2017
psql=/awips2/psql/bin/psql
index=binlightning_sourceIndex
table=awips.binlightning
sql="CREATE INDEX IF NOT EXISTS ${index} ON ${table} USING btree(source);"
${psql} -U awipsadmin -d metadata -c "${sql}"
if [[ $? -ne 0 ]]; then
echo "ERROR: Failed to create index ${index} on table ${table}."
echo "FATAL: The update has failed."
exit 1
fi
echo "INFO: the update has completed successfully!"
exit 0