mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
fix 12-migrations.sh properly detecting new migrations and printing output
This commit is contained in:
parent
a665168031
commit
ca5710b5ae
1 changed files with 14 additions and 6 deletions
|
@ -12,17 +12,25 @@ entrypoint-set-script-name "$0"
|
|||
# Wait for the database to be ready
|
||||
await-database-ready
|
||||
|
||||
# Detect if we have new migrations
|
||||
declare -i new_migrations=0
|
||||
(run-as-runtime-user php artisan migrate:status || :) | grep No && new_migrations=1
|
||||
# Run the migrate:status command and capture output
|
||||
output=$(run-as-runtime-user php artisan migrate:status || :)
|
||||
|
||||
if is-true "${new_migrations}"; then
|
||||
log-info "No outstanding migrations detected"
|
||||
# By default we have no new migrations
|
||||
declare -i new_migrations=0
|
||||
|
||||
# Detect if any new migrations are available by checking for "No" in the output
|
||||
echo "$output" | grep No && new_migrations=1
|
||||
|
||||
if is-false "${new_migrations}"; then
|
||||
log-info "No new migrations detected"
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
log-warning "New migrations available!"
|
||||
log-warning "New migrations available"
|
||||
|
||||
# Print the output
|
||||
echo "$output"
|
||||
|
||||
if is-false "${DB_APPLY_NEW_MIGRATIONS_AUTOMATICALLY}"; then
|
||||
log-info "Automatic applying of new database migrations is disabled"
|
||||
|
|
Loading…
Reference in a new issue