awips2/deltaScripts/unified_grid_rollback/create_grid_tables.sh
Ben Steffensmeier 9045142a79 Issue #189 grid rollback scripts
Change-Id: I3528a978c649827578ae3488a5e2f67ae075e984

Former-commit-id: 42e2756eb9 [formerly 106c178ce7] [formerly 42e2756eb9 [formerly 106c178ce7] [formerly b894cabe78 [formerly 8dc280e92f0512e05bac6fe01b33a8c21fc6b4f3]]]
Former-commit-id: b894cabe78
Former-commit-id: 43b47533aa [formerly 66ed210fea]
Former-commit-id: ca871da8f8
2012-10-11 18:22:12 -05:00

58 lines
No EOL
1.2 KiB
Bash

#!/bin/bash
# This script will add create tables for the grid plugin
#
# This needs to be performed with build ????
#
PSQL="/awips2/psql/bin/psql"
GRID_COMMAND="DROP TABLE grid;"
INFO_SEQ_COMMAND="DROP SEQUENCE gridinfo_seq;"
INFO_COMMAND="DROP TABLE grid_info;"
PARAM_COMMAND="DROP TABLE parameter;"
SQL_COMMAND_REGISTER="delete from plugin_info where name = 'grid' OR name = 'parameter';"
if [ ! -f ${PSQL} ]; then
echo "ERROR: The PSQL executable does not exist - ${PSQL}."
echo "FATAL: Update Failed!"
exit 1
fi
echo ""
echo "Press Enter to undo the updates Ctrl-C to quit."
read done
${PSQL} -U awips -d metadata -c "${SQL_COMMAND_REGISTER}"
if [ $? -ne 0 ]; then
echo "FATAL: Update Failed!"
exit 1
fi
${PSQL} -U awips -d metadata -c "${GRID_COMMAND}"
if [ $? -ne 0 ]; then
echo "FATAL: Update Failed!"
exit 1
fi
${PSQL} -U awips -d metadata -c "${INFO_COMMAND}"
if [ $? -ne 0 ]; then
echo "FATAL: Update Failed!"
exit 1
fi
${PSQL} -U awips -d metadata -c "${INFO_SEQ_COMMAND}"
if [ $? -ne 0 ]; then
echo "FATAL: Update Failed!"
exit 1
fi
${PSQL} -U awips -d metadata -c "${PARAM_COMMAND}"
if [ $? -ne 0 ]; then
echo "FATAL: Update Failed!"
exit 1
fi
echo "INFO: The update was successfully applied."
exit 0