How to create a new column in sales_order_item table in magento2 - Magento source24

 

How to create a new column in sales_order_item table in magento2

➤ In this post im share with you to How to create a new column in sales_order_item table in magento2


  1. create a db_schema.xml in etc folder .
  2. paste this inside this file
  3. change column name as your requirement 
  4. 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 : 

  1. php bin/magento setup:upgrade 
  2. php bin/magento setup:static-content:deploy -f 
  3. php bin/magento cache:flush


➤  then check your database table - in this table three new column are created : 


  1. is_customized 
  2. customized_image 
  3. customized_parts







Deepak Kumar Bind

Success is peace of mind, which is a direct result of self-satisfaction in knowing you made the effort to become the best of which you are capable.

Post a Comment

If you liked this post please do not forget to leave a comment. Thanks

Previous Post Next Post