➤ In this post im share with you to How to create a new column in sales_order_item table in magento2
- create a db_schema.xml in etc folder .
- paste this inside this file
- change column name as your requirement
- then save file
<?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 save file you run bellow command :
- php bin/magento setup:upgrade
- php bin/magento setup:static-content:deploy -f
- php bin/magento cache:flush
➤ then check your database table - in this table three new column are created :
- is_customized
- customized_image
- customized_parts