Add ignoreMigrations to the service provider. - #9
Open
MellieVT wants to merge 3 commits into
Open
Conversation
Author
|
Also no test, because the current pest test merely checks the service provider boots, and you can't exactly run tests without the migration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
::ignoreMigrations()toScoutPostgres\ScoutPostgresServiceProvider, because as-is there is no normal framework way to prevent this package from attempting to run its migrations outside of:ScoutPostgres\ScoutPostgresServiceProvidertoApp\Providers\ScoutPostgresServiceProvider.scout-postgres, so it'll take priority).ScoutPostgres\ScoutPostgresServiceProviderin composer'spackages.dont-discover.Type of change
Checklist
composer qualitypasses clean (Rector, Pint, PHPStan level max).composer testpasses locally against Postgres 14+.CHANGELOG.mdupdated with an entry describing the change, using Keep a Changelog categories.feat:,fix:,docs:, …).Notes for reviewers
Yes, you can just copy/paste the service provider, but this is the first package I've had to do this to in about 12 years of using Laravel. Is there a reason the service provider doesn't use
->publishesMigrations()for the migration like the current package guidance and instead runs them directly?I'd have changed the package to use
publishesMigrations, but that is a subtle backwards-compatibility break (by default the published migrations will have the current timestamp). I'd also have just extended the service provider too, but you've made themfinal. This is the route that seems the most future-proof, to be honest.