It throws an error, if the DB does not exist.
Could you please change the line
psql postgres -U musicbrainz -h db -c "DROP DATABASE musicbrainz_db;"; createdb.sh "$@"
into
psql postgres -U musicbrainz -h db -c "DROP DATABASE IF EXISTS musicbrainz_db;"; createdb.sh "$@"
according to https://www.postgresql.org/docs/current/sql-dropdatabase.html
This would allow to use recreatedb.sh in any case.
If the DB does not exist, it does not stop working with an error:
ERRROR: database "musicbrainz_db" does not exist
ERROR: 1
If the DB does exist, it will be dropped/deleted and then - inside the script createdb.sh - newly created.
Thank you for pointing this out, it’s likely an oversight. Change made in commit 2317ebf792455c9841223384cf69fedbdd26b99b. It will be part of today’s release.
https://github.com/metabrainz/musicbrainz-docker/blob/master/build/musicbrainz/scripts/recreatedb.sh
It throws an error, if the DB does not exist. Could you please change the line
psql postgres -U musicbrainz -h db -c "DROP DATABASE musicbrainz_db;"; createdb.sh "$@"
intopsql postgres -U musicbrainz -h db -c "DROP DATABASE IF EXISTS musicbrainz_db;"; createdb.sh "$@"
according to https://www.postgresql.org/docs/current/sql-dropdatabase.htmlThis would allow to use
recreatedb.sh
in any case. If the DB does not exist, it does not stop working with an error:If the DB does exist, it will be dropped/deleted and then - inside the script createdb.sh - newly created.