Former-commit-id:46a94c88cd
[formerly09f41a6b31
] [formerly56745c942e
] [formerly46a94c88cd
[formerly09f41a6b31
] [formerly56745c942e
] [formerlyc8e373c098
[formerly56745c942e
[formerly 469c2c597b80fd725f474e0d645656e4054fd69a]]]] Former-commit-id:c8e373c098
Former-commit-id:d25ceb8da7
[formerlya526600e3e
] [formerly d5d0bc708d2a84d887a8b1401a4d596af0a188e3 [formerlye1721cad00
]] Former-commit-id: e5bdfc9c23d1ad9869b9fa62e5f577d39c450737 [formerly18b4d133c7
] Former-commit-id:55708f1d55
33 lines
908 B
Bash
33 lines
908 B
Bash
#!/bin/bash
|
|
# DR #1846 - this update script will remove all datauri_idx indices from the metadata database
|
|
|
|
PSQL="/awips2/psql/bin/psql"
|
|
RETRIEVE_INDEX_SQL="SELECT indexname FROM pg_indexes WHERE indexname LIKE '%datauri_idx%' ORDER BY indexname;"
|
|
_index_list_txt=indexlist.txt
|
|
|
|
echo "INFO: update started"
|
|
|
|
# retrieve the indices
|
|
${PSQL} -U awips -d metadata -c "${RETRIEVE_INDEX_SQL}" -t -o ${_index_list_txt}
|
|
if [ $? -ne 0 ]; then
|
|
echo "ERROR: Failed to retrieve the list of data uri indices."
|
|
echo "FATAL: The update has failed."
|
|
exit 1
|
|
fi
|
|
|
|
for index in `cat ${_index_list_txt}`;
|
|
do
|
|
# remove the index
|
|
${PSQL} -U awips -d metadata -c "DROP INDEX ${index};"
|
|
if [ $? -ne 0 ]; then
|
|
echo "ERROR: Failed to drop index - ${index}."
|
|
echo "FATAL: The update has failed."
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
rm -f ${_index_list_txt}
|
|
|
|
echo "INFO: the update has completed successfully!"
|
|
|
|
exit 0
|