1
0
mirror of https://github.com/timescale/timescaledb.git synced 2025-05-16 02:23:49 +08:00
timescaledb/scripts/check_update_scripts.sh
Sven Klemm 45cf7f1fa1 Document requirements for statements in sql files
Since we now lock down search_path during update/downgrade there
are some additional requirements for writing sql files.
2022-02-18 14:15:11 +01:00

17 lines
462 B
Bash
Executable File

#! /bin/bash
SCRIPT_DIR=$(dirname ${0})
SRC_DIR=$(dirname ${SCRIPT_DIR})
if grep -i "IF NOT EXISTS" ${SRC_DIR}/sql/*.sql ${SRC_DIR}/sql/*/*.sql; then
cat <<EOF
Update scripts must unconditionally add new objects and fail when the object
already exists otherwise this might enable privilege escalation attacks where
an attacker can precreate objects that get used in later parts of the scripts
instead of the objects created by timescaledb.
EOF
exit 1
fi