28 lines
481 B
Bash
28 lines
481 B
Bash
#! /bin/bash
|
|
|
|
query_file() {
|
|
psql -v ON_ERROR_STOP=1 --single-transaction --quiet "$1" --file="$2" 1>&2
|
|
}
|
|
|
|
query() {
|
|
psql -v ON_ERROR_STOP=1 --single-transaction --quiet "$1" --command="$2" 1>&2
|
|
}
|
|
|
|
schema_changed() {
|
|
base="$1"
|
|
head="$2"
|
|
if [[ -z "$head" ]]; then
|
|
base="$1~"
|
|
head="$1"
|
|
fi
|
|
|
|
schema_changed=$(git diff --quiet "$base" "$head" -- ./schema)
|
|
schema_changed_exit=$?
|
|
|
|
if [[ "$schema_changed_exit" = "1" ]]; then
|
|
exit 0
|
|
else
|
|
exit 1
|
|
fi
|
|
}
|