ExamGecko
Question list
Search
Search

Question 28 - AD0-E711 discussion

Report
Export

A developer wants to rename a column in a custom module, so both columns were added to db Which additional action, if any. is needed to migrate data between the two columns?

A.
No additional action will be needed since the data is migrated automatically.
Answers
A.
No additional action will be needed since the data is migrated automatically.
B.
Add onCreate="migrateDataFrom(old_column_name)" in the column definition in db_schema.xml.
Answers
B.
Add onCreate="migrateDataFrom(old_column_name)" in the column definition in db_schema.xml.
C.
Add 'old’ attribute with the previous name of the column in the db_schema.xml.
Answers
C.
Add 'old’ attribute with the previous name of the column in the db_schema.xml.
Suggested answer: B

Explanation:

To migrate data between two columns when renaming a column in a custom module, add onCreate="migrateDataFrom(old_column_name)" in the column definition in the db_schema.xml file. This will ensure that the data is migrated from the old column to the new column. Reference:

https://devdocs.magento.com/guides/v2.4/extension-dev-guide/declarative-schema/dbschema.html#on-create

asked 02/10/2024
Przemysław Doczkal
39 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first