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.
While working on a squad system update, I found a migration that depends on the business logic: https://github.com/eveseat/web/blob/fe45844ab67e68761720ce536d0ce481b4ff0f39/src/database/migrations/2020_12_06_220254_upgrade_squads_maj4_min4_hf2.php
This is a bad idea, since when the data the business logic operates on changes, the migrations breaks since the migration updating the data for the business logic didn't run yet. However, this migration is there to remove a broken state, so not running it is not an option.
The solution that this PR enables are deferred migrations: A migration can schedule a closure that should be run after all other migrations have completed. This means the data is already migrated to a state where the business logic is guaranteed to be able process it.
In a migration, using
DeferredMigration::schedule
, a migration can schedule a deferred migration: