mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-12 17:44:31 +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
|
# Wait for the database to be ready
|
||||||
await-database-ready
|
await-database-ready
|
||||||
|
|
||||||
# Detect if we have new migrations
|
# Run the migrate:status command and capture output
|
||||||
declare -i new_migrations=0
|
output=$(run-as-runtime-user php artisan migrate:status || :)
|
||||||
(run-as-runtime-user php artisan migrate:status || :) | grep No && new_migrations=1
|
|
||||||
|
|
||||||
if is-true "${new_migrations}"; then
|
# By default we have no new migrations
|
||||||
log-info "No outstanding migrations detected"
|
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
|
exit 0
|
||||||
fi
|
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
|
if is-false "${DB_APPLY_NEW_MIGRATIONS_AUTOMATICALLY}"; then
|
||||||
log-info "Automatic applying of new database migrations is disabled"
|
log-info "Automatic applying of new database migrations is disabled"
|
||||||
|
|
Loading…
Reference in a new issue