Skip to content

How to create and upgrade database table in Magento 2

Today, we will guide you on how to create and upgrade database table in Magento 2. so now I am going to explain step by step.

1. Create Table in Database

To create an InstallSchema script, navigate to the app/code/DEv/Testingfolder and create a Setupfolder.

Create the file Setup/InstallSchema.php.

2. Add new column in existing table using upgrade method in Magento 2

Here is an example of adding an extra column named ‘short_description’ under the table name ‘dev_testing’.

Create the file ‘UpgradeSchema.php’ in the setup folder of the module

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Share via
Copy link
Powered by Social Snap