Skip to content

[Magento 2.3.x] Declarative Schema :: Data/Schema Patches getAliases() not working as expected #23031

Closed
@atishgoswami

Description

@atishgoswami

Preconditions

Project Environment

Magento Version: 2.3.x CE
PHP: 7.2
Database: MySQL 5.7
OS: CentOS 7
Caching: Varnish Cache and OPcache

Steps to reproduce

  1. Create a schema patch with a class name e.g. ExampleSchemaPatch
  2. Add a logger inside the apply method for the schema patch class to indicate that the apply method was executed
  3. Run setup:upgrade
  4. Check the patch_list table a fully qualified class name for the patch class would be present
  5. Check the log file to confirm that the apply method for the patch was executed
  6. Now change the class name of the applied patch to some something else e.g. ChangedExampleSchemaPatch
  7. Added the old class name as an array item for the return array for the getAliases() method
public function getAliases()
{
    return [
        ExampleSchemaPatch::class
    ];
}
  1. Run setup upgrade one more time

Actual Result

  1. The patch gets reapplied. This can be verified by checking the log file
  2. A new entry of the renamed patch is added to the patch_list table

Expected Result

The patch should not be reapplied.

Note: This issue can be replicated for Data as well as schema patches

Metadata

Metadata

Assignees

Labels

Component: Framework/SetupUSE ONLY for FRAMEWORK RELATED BUG! E.g If bug occurs during Catalog Setup use just CatalogIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions