metabrainz / musicbrainz-docker

Docker Compose project for the MusicBrainz Server with replication, search, and development setup
https://musicbrainz.org/doc/MusicBrainz_Server/Setup
284 stars 72 forks source link

Please add "IF EXIST" to recreatedb.sh script #251

Closed PeterCodar closed 1 year ago

PeterCodar commented 1 year ago

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 "$@" 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.

yvanzo commented 1 year ago

Thank you for pointing this out, it’s likely an oversight. Change made in commit 2317ebf792455c9841223384cf69fedbdd26b99b. It will be part of today’s release.