How To Add A Column To Existing Database Table In Magento 2

How To Add A Column To Existing Database Table In Magento 2

Magento 2 allows a developer to create, upgrade, or delete a table in the database. Earlier I talked about how to create and upgrade database in Magento 2. However, there were queries regarding the programmatic method to add a column to existing database table in Magento 2.

You can use the below code for the same. For example, adding an order delivery date column to the order table in the database.

While development tasks, whenever you need to add a custom column in the existing database table, bookmark this post for reference.

Method To Add A Column To Existing Database Table In Magento 2:

That’s it.

Use the Comments section below to mention any further doubts.

Feel free to share the solution via social media among the Magento community.

Thanks.

0
(based on 0 Reviews)

Sanjay is a co-founder at Meetanshi. He is a Certified Magento Developer who loves creating Magento E-commerce solutions. Owing to his contributions in Magento Forums and posting solutions, he is among the top 50 contributors of the Magento community in 2019. When he is not engrossed with anything related to Magento, he loves to play cricket.

Leave a Reply

SUBSCRIBE
3.8
(based on 5 Reviews)