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

[11.x] Allow setting exit code in migrate:status --pending #51341

Merged
merged 3 commits into from
May 9, 2024

Conversation

brecht-vermeersch
Copy link
Contributor

@brecht-vermeersch brecht-vermeersch commented May 8, 2024

When we deploy our Laravel application with docker, we first launch a job that does the following:

php artisan down
php artisan migrate
php artisan up

We use the down command with the cache driver to bring down the other containers (workers, schedulers, ...)

The issue with this setup is that we run the down command even if there are no pending migrations.

With this PR the following is possible

php artisan migrate:status --pending=100

exit_code=$?

if [ $exit_code -eq 100 ]; then
    # this code is skipped when there are no pending migrations
    php artisan down
    php artisan migrate
    php artisan up
fi

Syntax for the command option is inspired by the artisan migrate --isolate

@brecht-vermeersch brecht-vermeersch changed the title [11.x] Allow setting exit code when pending migrations are found in the migrate:status command [11.x] Allow setting exit code in the migrate:status --pending May 8, 2024
@brecht-vermeersch brecht-vermeersch changed the title [11.x] Allow setting exit code in the migrate:status --pending [11.x] Allow setting exit code in migrate:status --pending May 8, 2024
@brecht-vermeersch brecht-vermeersch marked this pull request as draft May 8, 2024 11:24
@brecht-vermeersch brecht-vermeersch marked this pull request as ready for review May 8, 2024 11:36
@bert-w
Copy link
Contributor

bert-w commented May 8, 2024

It's weird how the --pending boolean option accepts exitcodes tbh.

@NickSdot
Copy link
Contributor

NickSdot commented May 9, 2024

I tried to get in the same feature last year.

Taylor, please re-consider to accept something like this.

@taylorotwell taylorotwell merged commit d6123dd into laravel:11.x May 9, 2024
28 checks passed
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

Successfully merging this pull request may close these issues.

4 participants