-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[Fixed: #31396] Data/Schema Patches getAliases() not working as expected #31635
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
base: 2.4-develop
Are you sure you want to change the base?
Conversation
Hi @Usik2203. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. 🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
@magento run all tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Usik2203. Thank you for your contribution.
Please, check the failing tests.
@magento run all tests |
@magento run all tests |
@magento run all tests |
Hi @rogyar |
This kind of fixes the issue but I see a problem here. But for someone who never applied the old path patch, it will get applied. Which is good. So there will be not consistency in terms of the path_list table. I guess for someone who has the new patch_name it will be better, as the patch applier will not check the list of patches against the aliases? |
{ | ||
if ($dataPatchAliases = $dataPatch->getAliases()) { | ||
foreach ($dataPatchAliases as $patchAlias) { | ||
return $this->patchHistory->isApplied($patchAlias) ?? true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->patchHistory->fixPatch($patchAlias); | ||
if (!$this->checkPatchAliases($schemaPatch)) { | ||
$schemaPatch->apply(); | ||
$this->patchHistory->fixPatch(get_class($schemaPatch)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Usik2203 We should still also loop over every alias and mark them as applied. In the case where a patch file is renamed (e.g. changing the namespace of a module), if we install the new version and only mark the new name as installed, rolling back to before the change will result in the same patch applying a second time. If we mark all aliases as installed, then it will prevent that from happening.
Description (*)
This PR fixed next issues #31396 #23031
Fixed Issues (if relevant)
#31396
#23031
Testing Scenario
1. New patch was created

\Atwix\DataPatchTest\Setup\Patch\Data\ExampleDataPatch
and successfully applied.2. This patch was renamed to
Atwix\DataPatchTest\Setup\Patch\Data\ChangedExampleDataPatch
and was added Alias3. run

bin/magento se:up
Actual result
Only
\Atwix\DataPatchTest\Setup\Patch\Data\ExampleDataPatch
was appliedI didn't see errors in console after steps 2. and 3.