Fail entrypoint if migration fails (#8590)

If migration fails for some reason, the script runs anyway and creates
the file which indicates that migration is complete. This is obviously
not cool. If database is not available for some reason and migrations
fail, the container should exit, not continue.

Relevant stack overflow: https://stackoverflow.com/a/2871034
This commit is contained in:
Sasank Chilamkurthy 2024-11-19 23:27:15 +05:30 committed by GitHub
parent 4f2019edae
commit d90c3110cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,5 @@
#!/bin/sh #!/bin/sh
set -e
# Check if the initialization has already been done and that we enabled automatic migration # Check if the initialization has already been done and that we enabled automatic migration
if [ "${ENABLE_DB_MIGRATIONS}" = "true" ] && [ ! -f /app/docker-data/db_status ]; then if [ "${ENABLE_DB_MIGRATIONS}" = "true" ] && [ ! -f /app/docker-data/db_status ]; then