AD0-E717 practice question 8 of 15
A developer defined a new table in db.schema.xml while creating a new module. What should be done to allow the removal of columns from the database when deleting them from db.schema.xml?
Full set: 77 questionsMagento's declarative schema feature, by default, does not perform destructive operations like dropping tables or columns to prevent accidental data loss. To enable these operations, a module must have a dbschemawhitelist.json file. This file acts as a snapshot of the module's database schema. When bin/magento setup:upgrade is run, Magento compares the current dbschema.xml with the dbschemawhitelist.json. If a column exists in the whitelist but has been removed from the dbschema.xml, Magento interprets this as an intentional deletion and will generate the SQL to drop the column from the database.
B. The removable="true" attribute is used to indicate that a schema element (like a column or table) can be altered or removed by another module, which is useful for extension compatibility, but it does not enable the drop operation itself.
C. The file db.schemablacklist.json is not a standard file used by Magento's declarative schema process for managing column removal. ---
1. Adobe Commerce Developer Documentation, "Declarative schema":
Section: Destructive operations
Content: "By default, declarative schema is configured to run in a safe mode, which does not allow destructive operations... To enable destructive operations, you must generate a dbschemawhitelist.json file... When you run setup:upgrade, Magento compares the dbschema.xml file with the module’s dbschemawhitelist.json file. If the whitelist file contains entries that are not in the dbschema.xml file, it means that these database structures have been removed, and they can be dropped."
URL: https://developer.adobe.com/commerce/php/development/components/declarative-schema/
2. Adobe Commerce Developer Documentation, "Configure declarative schema":
Section: The removable attribute
Content: "The removable attribute indicates that the element is not part of the Magento core schema. The default value is true. Set this attribute to false to prevent an element from being removed." This confirms the attribute's purpose is related to inter-module compatibility and prevention, not enabling the drop mechanism.
URL: https://developer.adobe.com/commerce/php/development/components/declarative-schema/configuration/
Keep practicing
Take the free AD0-E717 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other AD0-E717 practice questions
- Question 1A developer is creating a class \Vendor\Module\Model\MyModeL How should that class be def…
- Question 2What is one purpose of a customer data JS library?
- Question 3What folder would a developer place a custom patch on an Adobe Commerce Cloud project to …
- Question 4What action can be performed from the Cloud Project Portal (Onboarding Ul) of an Adobe Co…
- Question 5What database engine is part of the infrastructure of Adobe Commerce Cloud projects?
- Question 6What is the default store ID for the admin panel?
