awips2/deltaScripts/16.4.1/DR4935/alter_ccfp_unique_constraint.sh
2022-05-05 12:34:50 -05:00

18 lines
520 B
Bash
Executable file

#!/bin/bash
# DR #5335 - This script alters the multi-column unique constraint of the ccfp
# table to include the rangestart and rangeend columns
TABLE=ccfp
PSQL="/awips2/psql/bin/psql"
echo "INFO: Altering table ${TABLE}"
${PSQL} -U awips -d metadata << EOF
begin transaction;
alter table ${TABLE}
drop constraint if exists uk_${TABLE}_datauri_fields,
add constraint uk_${TABLE}_datauri_fields unique
(reftime, rangestart, rangeend, producttype, boxlat, boxlong);
commit transaction;
EOF