Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
PeterCodar opened this issue May 20, 2023 · 1 comment
Closed

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

PeterCodar opened this issue May 20, 2023 · 1 comment

Comments

@PeterCodar
Copy link

PeterCodar commented May 20, 2023

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
Copy link
Contributor

yvanzo commented May 22, 2023

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

@yvanzo yvanzo closed this as completed May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants