Video Lesson: Automatically remove database fields in Magento

Automatically remove database fields in Magento

This is premium content

Only available to enrolled or University students.
Join today to unlock all lessons in this course.

Automatically remove database fields in Magento

Automatically remove database fields in Magento using db_schema_whitelist.json and setup upgrade command.

Lesson Content

If we were to remove some entries from the db_schema.xml file, Magento will not automatically remove them. This is because Magento errs on the side of backwards-compatibility in order to support older upgrade scripts that were used before declarative schema was introduced.

To have these columns or indexes automatically removed whenever setup:upgrade is executed, all you need to do is generate a whitelist.

This can be done from the command line. After opening up terminal, let’s run bin/magento setup:db-declaration:generate-whitelist

After running this line, we’ll notice a new `db...

Premium content

Enroll to unlock the full content and all course materials.

Maggie

Hey, I'm Maggie! 👋

Ask me anything.

Want to chat with Maggie?

Enroll in this course for AI tutor access.

Comments

Join the discussion!

Comments

Want to comment on this lesson?

Enroll in this course to leave comments.