nerdexam
Adobe

AD0-E716 · Question #27

An Adobe Commerce developer is creating a module (Vendor.ModuleName) to be sold on the Marketplace. The new module creates a database table using declarative schema and now the developer needs to…

The correct answer is C. Add a schema patch that implements Magento\Framework\setup\Patch\PatchRevertabieinterface. According to the Declarative Schema Overview guide for Magento 2 developers, declarative schema is a new feature that allows developers to declare the final desired state of the database and has the system adjust to it automatically, without performing redundant operations…

Database

Question

An Adobe Commerce developer is creating a module (Vendor.ModuleName) to be sold on the Marketplace. The new module creates a database table using declarative schema and now the developer needs to make sure the table is removed when the module is disabled. What must the developer do to accomplish this?

Options

  • AThere is nothing further the developer needs to do. The table will be removed when the module is
  • BThere is nothing further the developer needs to do. The table will be removed when the when
  • CAdd a schema patch that implements Magento\Framework\setup\Patch\PatchRevertabieinterface

How the community answered

(65 responses)
  • A
    14% (9)
  • B
    6% (4)
  • C
    80% (52)

Explanation

According to the Declarative Schema Overview guide for Magento 2 developers, declarative schema is a new feature that allows developers to declare the final desired state of the database and has the system adjust to it automatically, without performing redundant operations. However, declarative schema does not support uninstalling modules or reverting changes. To remove a table when a module is disabled, the developer needs to add a schema patch that implements Magento\Framework\setup\Patch\PatchRevertabieinterface and drops the table in the revert function. The revert function will be executed when the module is disabled using bin/magento module:disable command. Verified Reference: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/declarative-schema/

Topics

#declarative schema#PatchRevertableInterface#module uninstall#database management

Community Discussion

No community discussion yet for this question.

Full AD0-E716 Practice