Skip to content

[Magento 2.3.x] Data/Schema Patches getAliases() causes errors during setup:upgrade #31396

Open
@PauloPhagula

Description

@PauloPhagula

Preconditions (*)

Project Environment

Magento 2.4-develop
Magento Version: 2.3.x CE
PHP: 7.4
Database: MySQL 8.0
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

Expected result (*)

  1. The second setup:upgrade should run normally with no errors whatsoever

Actual result (*)

  1. setup:upgrade fails while applying patch. Mentioning that the original (now aliased) patch has already been applied

Screenshot from 2020-12-23 16-46-39


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Labels

Component: SetupIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: ready for confirmationPriority: P3May be fixed according to the position in the backlog.Progress: PR in progressReported on 2.3.xIndicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S3Affects non-critical data or functionality and does not force users to employ a workaround.Triage: 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