Former-commit-id:79567aac51
[formerlyf95e0ad10b
] [formerly2f517b7713
] [formerly79567aac51
[formerlyf95e0ad10b
] [formerly2f517b7713
] [formerly00332e6305
[formerly2f517b7713
[formerly c03222bb480d87c05982b4d49f863e615b5b5584]]]] Former-commit-id:00332e6305
Former-commit-id:aecc3cfd89
[formerly0e950655f1
] [formerly fff69f92a60e6f16033e299ff1dd2395fac95290 [formerly4accbb80db
]] Former-commit-id: 85465ead73fe31102e486ee012a5fcb51cfcc9b9 [formerly4001e050e7
] Former-commit-id:722e428c74
35 lines
900 B
Bash
35 lines
900 B
Bash
#!/bin/bash
|
|
|
|
#!/bin/bash
|
|
# DR #1846 - this update script will remove all hdffileid columns from the metadata database
|
|
|
|
PSQL="/awips2/psql/bin/psql"
|
|
SQL="SELECT table_name FROM information_schema.columns WHERE column_name = 'hdffileid';"
|
|
_table_list_txt=tablelist.txt
|
|
|
|
echo "INFO: update started."
|
|
|
|
# retrieve the tables
|
|
|
|
${PSQL} -U awips -d metadata -c "${SQL}" -t -o ${_table_list_txt}
|
|
if [ $? -ne 0 ]; then
|
|
echo "ERROR: Failed to retrieve the list of tables."
|
|
echo "FATAL: The update has failed."
|
|
exit 1
|
|
fi
|
|
|
|
for table in `cat ${_table_list_txt}`;
|
|
do
|
|
${PSQL} -U awips -d metadata -c "ALTER TABLE ${table} DROP COLUMN hdffileid CASCADE;"
|
|
if [ $? -ne 0 ]; then
|
|
echo "ERROR: Failed to drop column hdffileid in table ${table}."
|
|
echo "FATAL: The update has failed."
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
rm -f ${_table_list_txt}
|
|
|
|
echo "INFO: the update has completed successfully!"
|
|
|
|
exit 0
|