awips2/deltaScripts/16.2.2/DR5286/alter_tcg_drop_datauri.sh
2017-04-21 18:33:55 -06:00

21 lines
603 B
Bash
Executable file

#!/bin/bash
# DR #5286 - This script drops dataURI column from tcg table and adds a new
# multi-column unique constraint
TABLE=tcg
DBUSER=awips
PSQL="/awips2/psql/bin/psql"
echo "INFO: Altering table ${TABLE}"
${PSQL} -U ${DBUSER} -d metadata << EOF
begin transaction;
alter table ${TABLE}
drop constraint if exists uk_${TABLE}_datauri_fields,
drop column if exists datauri,
add constraint uk_${TABLE}_datauri_fields unique
(reftime, forecasttime, producttype, modelname, latitude, longitude, stationid);
drop index if exists tcg_refTimeIndex;
commit transaction;
EOF