Skip to content
Snippets Groups Projects
Commit 760d885b authored by Krzysztof Leśniak's avatar Krzysztof Leśniak Committed by Bartek Wrona
Browse files

Add check_tables_dont_reference_haf_types

This checks that no user table has reference to haf sql type.
Such column would be dropped during upgrade, so the update script
refuses to continue when it is found.
parent c1cc26d3
No related branches found
No related tags found
6 merge requests!627merge in fix for get_current_block_age,!626Fix get_current_block_age function to avoid healthcheck fails,!622merge develop to master,!599merge ( with merge commit) develop to master,!597Merge develop to master for release,!366Improve HAF upgrade script
......@@ -137,6 +137,19 @@ make_update() {
sudo -Enu "$DB_ADMIN" psql -w $POSTGRES_ACCESS -d "$DB_NAME" -v ON_ERROR_STOP=on -U "$DB_ADMIN" -c "ALTER EXTENSION hive_fork_manager UPDATE"
}
check_tables_dont_reference_haf_types() {
echo
echo "Checking that none table references HAF type..."
# hive.operation is explicitly ignored, because we never drop this type, so it's safe as a column.
query="
SELECT table_schema,table_name,column_name,udt_schema,udt_name
FROM information_schema.columns
WHERE udt_schema='hive' AND table_schema<>'hive' AND udt_name<>'operation'"
sudo -Enu "$DB_ADMIN" psql -w $POSTGRES_ACCESS -d "$DB_NAME" -v ON_ERROR_STOP=on -U "$DB_ADMIN" -q -t -A -c "$query" | \
awk -F'|' '{print($1"."$2, "contains column", $3, "of type", $4"."$5, "which would be dropped on upgrade")} END{exit NR > 0 ? 4 : 0}'
}
check_functions_were_updated() {
echo
echo "Checking that all C functions were properly updated..."
......@@ -157,6 +170,8 @@ get_deployed_version
generate_final_update_script
check_tables_dont_reference_haf_types
make_update
check_functions_were_updated
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment