awips2/deltaScripts/14.2.1/convertNcPirepAirep.sh
Ben Steffensmeier 95cc64f53c Issue #2316 Better upgrade script and feature files.
Change-Id: Ia86dce4fb73893a63ab35003eef8341cbfb0cd4b

Former-commit-id: dc50adc50c [formerly c09b38e5b5] [formerly 72728121e4] [formerly dc50adc50c [formerly c09b38e5b5] [formerly 72728121e4] [formerly af8fbacf72 [formerly 72728121e4 [formerly 7855257369af383399d6cc2ea94d743e139263d2]]]]
Former-commit-id: af8fbacf72
Former-commit-id: 68c1c842e3 [formerly 2a602a76f3] [formerly 4000178559eedc79d31c13f7792e66a0f2a44580 [formerly f289473792]]
Former-commit-id: 4479c6f2e926bf9e986904a654599a508d35eb04 [formerly 4d18d761c9]
Former-commit-id: a132ecda55
2013-09-05 13:22:12 -05:00

36 lines
No EOL
1 KiB
Bash

#!/bin/bash
# DR #2316,2317 replace airep and pirep with ncairep and ncpirep
PSQL="/awips2/psql/bin/psql"
SQL_COMMAND="
delete from plugin_info where name in ('ncpirep','ncairep');
drop table pirep, pirep_anc_data, ncpirep_anc_data, airep;
alter table ncpirep rename to pirep;
alter table ncairep rename to airep;
update pirep set datauri = replace(datauri, 'ncpirep', 'pirep');
update airep set datauri = replace(datauri, 'ncairep', 'airep');
"
${PSQL} -U awips -d metadata -c "${SQL_COMMAND}"
if [ -d "/awips2/edex/data/hdf5/ncpirep" ]
then
mv /awips2/edex/data/hdf5/ncpirep /awips2/edex/data/hdf5/pirep
files=`ls /awips2/edex/data/hdf5/pirep/ncpirep*.h5`
for file in $files; do
newfile=${file/ncpirep/pirep}
mv $file $newfile
done
fi
if [ -d "/awips2/edex/data/hdf5/ncairep" ]
then
mv /awips2/edex/data/hdf5/ncairep /awips2/edex/data/hdf5/airep
files=`ls /awips2/edex/data/hdf5/airep/ncairep*.h5`
for file in $files; do
newfile=${file/ncairep/airep}
mv $file $newfile
done
fi