Mercurial > gemma
comparison schema/install-db.sh @ 2679:a3cab473304d
Drop roles even if database does not exist
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 15 Mar 2019 12:06:04 +0100 |
parents | ce294a8635a5 |
children | f394e828a6d2 |
comparison
equal
deleted
inserted
replaced
2676:906e9a13592f | 2679:a3cab473304d |
---|---|
156 else | 156 else |
157 # Evil mode: drop everything gemma | 157 # Evil mode: drop everything gemma |
158 echo "Really drop database '$db' and all gemma roles? [type 'yes']: " | 158 echo "Really drop database '$db' and all gemma roles? [type 'yes']: " |
159 read a | 159 read a |
160 if [[ $a == "yes" ]] ; then | 160 if [[ $a == "yes" ]] ; then |
161 dropdb -p "$port" "$db" | 161 dropdb --if-exists -p "$port" "$db" |
162 psql -p $port -A -t -c '\du' | awk -F '|' -v port=$port \ | 162 psql -p $port -A -t -c '\du' | awk -F '|' -v port=$port \ |
163 '$1 "." $3 ~ /waterway_user|waterway_admin|sys_admin|metamorph/ \ | 163 '$1 "." $3 ~ /waterway_user|waterway_admin|sys_admin|metamorph/ \ |
164 { system("dropuser -p " port " \"" $1 "\"") }' | 164 { system("dropuser -p " port " \"" $1 "\"") }' |
165 else | 165 else |
166 echo "No harm done." | 166 echo "No harm done." |