Omaha #4360 Rename delta script's folder.

Change-Id: If551d6c39c7aca761200c1734dc537b912da3f84

Former-commit-id: 8ab4092c6a9059bbab59146f0d4c867d261b8efe
This commit is contained in:
Roger Ferrel 2015-08-03 16:22:40 -05:00
parent f696d5731d
commit 9797c7f2e0
12 changed files with 3 additions and 9 deletions

View file

@ -9,27 +9,21 @@ where table_catalog = 'metadata' and table_schema='awips' and constraint_type='U
constraint_name=(`${PSQL} -U awips -d metadata -t -c "$cmd"`)
if [ $? -ne 0 ] ; then
echo "ERROR: Failed to obtain 'unnamed' unique constraint on table $1"
echo "FATAL: The update failed."
exit 1
echo "ERROR: The update failed to obtain 'unnamed' unique constraint on table $1"
fi
cnLen=${#constraint_name[@]}
if [ ${cnLen} -eq 0 ] ; then
echo "WARNING: no UNIQUE constraint found for table $1"
elif [ ${cnLen} -gt 1 ] ; then
echo "ERROR: More then one unnamed UNIQUE constraint found for table ${1} (${constraint_name[@]})"
echo "FATAL: The update has failed."
exit 1
echo "ERROR: The update failed. More then one unnamed UNIQUE constraint found for table ${1} (${constraint_name[@]})"
elif [ ${constraint_name} == ${2} ] ; then
echo "INFO: No constraint rename on table ${table} performed; ${2} already exists."
else
echo "INFO: On $1 renaming constraint: ${constraint_name} to ${2}"
${PSQL} -U awips -d metadata -c "ALTER TABLE ${1} RENAME CONSTRAINT ${constraint_name} TO ${2} ;"
if [ $? -ne 0 ] ; then
echo "ERROR: Failed on table $1 to rename unique constraint ${constraint_name} to $2."
echo "FATAL: The update failed."
exit 1
echo "ERROR: The update failed on table $1 to rename unique constraint ${constraint_name} to $2."
fi
fi
}