How to create new coulmn in sales_order_item using db_schema in magento2
In this Blog Post i'm share with you to How to create new coulmn in sales_order_item using db_schema.xml in magento2
👉 Create a db_schema.xml file in VendorName/ModuleName/etc/db_schema.xml
👉 in this post i have create 3 column is_customized,customized_image and customized_parts using db_schema.xml
<?xml version="1.0"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="sales_order_item" resource="default" engine="innodb">
<column xsi:type="varchar" name="is_customized" nullable="true" length="255" comment="Is Customized"/>
<column xsi:type="varchar" name="customized_image" nullable="true" length="255" comment="Customized Image"/>
<column xsi:type="varchar" name="customized_parts" nullable="true" length="255" comment="Customized Parts"/>
</table>
</schema>
👉 After Done this Above Code then Run Bellow Command -
- php bin/magento setup:upgrade
- php bin/magento setup:static-content:deploy -f
- php bin/magento cache:flush
👉 and check your sales_order_item Databse table : your column is here