QuestionQ27

Setup/configuring Adobe Commerce Cloud

The developer must convert the module’s database scripts from legacy install/upgrade setup files to the data-patch format and does not want to apply database changes that the install/upgrade scripts already performed.

The current module version is 1.5.4.

What is the recommended solution for skipping changes that were already applied through the old-format install/upgrade scripts?

  • A Implement PatchVersionInterface and return 1.5.4 on the getVersion() method.
  • B Inside apply() method, check for module version and run the code if version is less than 1.5.4.
  • C This is not possible. A module cannot implement both data patch and install scripts.
Explanation

Implement PatchVersionInterface on the data patch and return 1.5.4 from getVersion(). Adobe Commerce compares that patch version with the module version recorded in the database; when the installed module version is equal to or greater than 1.5.4, it skips the patch, preserving backward compatibility with changes made by legacy scripts.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!