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

pass options to migration events #54151

Open
wants to merge 1 commit into
base: 11.x
Choose a base branch
from

Conversation

willpower232
Copy link
Contributor

As discussed in #48801

You can run php artisan migrate --pretend which outputs the raw SQL from the migrations rather than executing them.

The problem is this extra context is not added to the events issued

This means if you have database-altering code relying on these events, they could throw exceptions or cause errors in production.

I passed through the whole $options array to make it slightly more future proof in case there are other options added in the future.

I had a few issues writing tests for it which is why testMigrationEventsContainTheOptionsAndPretendTrue is a bit shorter but I also figure that the rollback event is tested in testMigrationEventsContainTheOptionsAndPretendFalse so doesn't necessarily need a duplicated test.

I would also be interested in changing the base event for php 8 constructor property promotion which I can see being used in a few other classes in the framework but I didn't want to just jump into that bit without confirming it was okay.

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.

1 participant