Let create_survey take an explicity schema name

This commit is contained in:
D. Berge
2020-09-02 18:57:42 +02:00
parent 19c0562888
commit 0cd1b30e29

View File

@@ -42,7 +42,7 @@ PGDATABASE=${PGDATABASE:-dougal}
LAST_SURVEY_ID=$(psql -U $PGUSER -h $PGHOST -Atc '\dn survey_[0-9]+' "$PGDATABASE" |sed -rn 's/^survey_([0-9]+).*$/\1/p' |sort -n |tail -n 1) LAST_SURVEY_ID=$(psql -U $PGUSER -h $PGHOST -Atc '\dn survey_[0-9]+' "$PGDATABASE" |sed -rn 's/^survey_([0-9]+).*$/\1/p' |sort -n |tail -n 1)
NEXT_SURVEY_ID=$((LAST_SURVEY_ID+1)) NEXT_SURVEY_ID=$((LAST_SURVEY_ID+1))
SCHEMA_NAME="survey_$NEXT_SURVEY_ID" SCHEMA_NAME="${SCHEMA_NAME:-survey_$NEXT_SURVEY_ID}"
[[ $# -ne 3 ]] && { [[ $# -ne 3 ]] && {
echo "Wrong number of arguments" echo "Wrong number of arguments"