ExamGecko
Question list
Search
Search

Question 32 - AD0-E717 discussion

Report
Export

In a new release of a module, a developer decides to rename a table that was defined in the earlier versions. Which action, if any, allows the developer to prevent data loss?

A.
Define onCreate='migrateDataFromAnotherTable(old_table_name)' attribute in the table tag.
Answers
A.
Define onCreate='migrateDataFromAnotherTable(old_table_name)' attribute in the table tag.
B.
Declarative schema supports RENAME TABLE', so the data will be migrated to the new table automatically.
Answers
B.
Declarative schema supports RENAME TABLE', so the data will be migrated to the new table automatically.
C.
Define the table and columns mapping in the db.schema_whitelist.json
Answers
C.
Define the table and columns mapping in the db.schema_whitelist.json
Suggested answer: A

Explanation:

To prevent data loss when renaming a table that was defined in the earlier versions of a module, the developer should define onCreate=''migrateDataFromAnotherTable(old_table_name)'' attribute in the table tag of the db_schema.xml file. This attribute will instruct Adobe Commerce to copy all data from the old table to the new table during installation or upgrade.

Declarative schema does not support RENAME TABLE statement, so the data will not be migrated to the new table automatically. The db.schema_whitelist.json file is used to whitelist changes that are allowed for backward compatibility, not for data migration.

Verified

Reference:Adobe Commerce Developer Guide - Declare schema and data patches

asked 02/10/2024
Shady Mohamed Ibrahim
31 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first