Magento 2 Certified Associate Developer — Question 5
You are developing a module and need to add another column to a table introduced by another module MyCompany_MyModule via db schema.
How do you do that?
Answer options
- A. Create a etc/db_schema.xml file in your module, add the column and run bin/magento setup:upgrade
- B. Create a etc/db.xml file in your module, add the column and run bin/magento setup:db-schema:upgrade
- C. Run a command: bin/magento setup:db-schema:upgrade <table> <column definition>
- D. Create a etc/db_schema_whitelist.json file in your module, add the column and run bin/magento setup:upgrade
Correct answer: C
Explanation
The correct answer is C because it directly utilizes the command to upgrade the database schema for a specific table and column definition. Options A and D are incorrect as they refer to the wrong file types and do not specifically address modifying the schema. Option B is also incorrect because it references the wrong command for schema upgrades.