How to add addition column in sales_order table using db_schema or in Magento2.3.1 best way?How to add new column in quote_item table?Add Custom attribute from Sales_Order table into New order email template?magento 2 - How to add new column to table customer_grid_flatbest way to add data to block from codeMagento 2: admin sales grid, filter column from sales_order tableHow to add extra fields in checkout page and save them into sales_order table?How to add New Column in Magento 2 beginning of the table using Magento 2 way?How custom attribute of “sales_order_item” table will be save also in “sales_order”Magento2: How to add new column in admin_user table?how i can get the column value of admin user table in magento 2

''Habitable'' planet close to a star

Cover a cube with four-legged walky-squares!

Will this tire fail its MOT?

Interviewing with an unmentioned 9 months of sick leave taken during a job

Why do space operations use "nominal" to mean "working correctly"?

What happens if there is no space for entry stamp in the passport for US visa?

Does the Intel 8085 CPU use real memory addresses?

How to honestly answer questions from a girlfriend like "How did you find this place" without giving the impression I'm always talking about my exes?

Is there an English equivalent for "Les carottes sont cuites", while keeping the vegetable reference?

What happens if a company buys back all of its shares?

Is it rude to refer to janitors as 'floor people'?

Did 007 exist before James Bond?

Finding all possible pairs of square numbers in an array

How could an animal "smell" carbon monoxide?

What is this green alien supposed to be on the American covers of the "Hitchhiker's Guide to the Galaxy"?

Is this artwork (used in a video game) real?

Kepler space telescope undetected planets

Did Voldemort kill his father before finding out about Horcruxes?

Is straight-up writing someone's opinions telling?

Intel 8080-based home computers

Is the purpose of sheet music to be played along to? Or a guide for learning and reference during playing?

Is it legal for a supermarket to refuse to sell an adult beer if an adult with them doesn’t have their ID?

Optimising the Selection of MaxValue in Association

How should one refer to knights (& dames) in academic writing?



How to add addition column in sales_order table using db_schema or in Magento2.3.1 best way?


How to add new column in quote_item table?Add Custom attribute from Sales_Order table into New order email template?magento 2 - How to add new column to table customer_grid_flatbest way to add data to block from codeMagento 2: admin sales grid, filter column from sales_order tableHow to add extra fields in checkout page and save them into sales_order table?How to add New Column in Magento 2 beginning of the table using Magento 2 way?How custom attribute of “sales_order_item” table will be save also in “sales_order”Magento2: How to add new column in admin_user table?how i can get the column value of admin user table in magento 2






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















How to add addition column in sales_order table using db_schema or in Magento2.3.1 best way?










share|improve this question
























  • use db_schema which is the easiest way to add columns or to delete column no need of script upgrade..

    – aravind
    Jul 9 at 9:19











  • but whole sales_order table need to define again in my script?

    – Rutvee Sojitra
    Jul 9 at 9:20











  • Check Ref: codextblog.com/magento-2/…

    – Rakesh Donga
    Jul 9 at 9:21











  • @RakeshDonga First try to understand my requirement. I am not asking for grid

    – Rutvee Sojitra
    Jul 9 at 9:22











  • @RutveeSojitra is it working for you?

    – Rohan Hapani
    Jul 15 at 4:42

















0















How to add addition column in sales_order table using db_schema or in Magento2.3.1 best way?










share|improve this question
























  • use db_schema which is the easiest way to add columns or to delete column no need of script upgrade..

    – aravind
    Jul 9 at 9:19











  • but whole sales_order table need to define again in my script?

    – Rutvee Sojitra
    Jul 9 at 9:20











  • Check Ref: codextblog.com/magento-2/…

    – Rakesh Donga
    Jul 9 at 9:21











  • @RakeshDonga First try to understand my requirement. I am not asking for grid

    – Rutvee Sojitra
    Jul 9 at 9:22











  • @RutveeSojitra is it working for you?

    – Rohan Hapani
    Jul 15 at 4:42













0












0








0








How to add addition column in sales_order table using db_schema or in Magento2.3.1 best way?










share|improve this question
















How to add addition column in sales_order table using db_schema or in Magento2.3.1 best way?







magento2 database-schema datatable






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 9 at 9:17









Jimit Bhavsar

5014 silver badges18 bronze badges




5014 silver badges18 bronze badges










asked Jul 9 at 9:13









Rutvee SojitraRutvee Sojitra

2,2941 gold badge4 silver badges22 bronze badges




2,2941 gold badge4 silver badges22 bronze badges












  • use db_schema which is the easiest way to add columns or to delete column no need of script upgrade..

    – aravind
    Jul 9 at 9:19











  • but whole sales_order table need to define again in my script?

    – Rutvee Sojitra
    Jul 9 at 9:20











  • Check Ref: codextblog.com/magento-2/…

    – Rakesh Donga
    Jul 9 at 9:21











  • @RakeshDonga First try to understand my requirement. I am not asking for grid

    – Rutvee Sojitra
    Jul 9 at 9:22











  • @RutveeSojitra is it working for you?

    – Rohan Hapani
    Jul 15 at 4:42

















  • use db_schema which is the easiest way to add columns or to delete column no need of script upgrade..

    – aravind
    Jul 9 at 9:19











  • but whole sales_order table need to define again in my script?

    – Rutvee Sojitra
    Jul 9 at 9:20











  • Check Ref: codextblog.com/magento-2/…

    – Rakesh Donga
    Jul 9 at 9:21











  • @RakeshDonga First try to understand my requirement. I am not asking for grid

    – Rutvee Sojitra
    Jul 9 at 9:22











  • @RutveeSojitra is it working for you?

    – Rohan Hapani
    Jul 15 at 4:42
















use db_schema which is the easiest way to add columns or to delete column no need of script upgrade..

– aravind
Jul 9 at 9:19





use db_schema which is the easiest way to add columns or to delete column no need of script upgrade..

– aravind
Jul 9 at 9:19













but whole sales_order table need to define again in my script?

– Rutvee Sojitra
Jul 9 at 9:20





but whole sales_order table need to define again in my script?

– Rutvee Sojitra
Jul 9 at 9:20













Check Ref: codextblog.com/magento-2/…

– Rakesh Donga
Jul 9 at 9:21





Check Ref: codextblog.com/magento-2/…

– Rakesh Donga
Jul 9 at 9:21













@RakeshDonga First try to understand my requirement. I am not asking for grid

– Rutvee Sojitra
Jul 9 at 9:22





@RakeshDonga First try to understand my requirement. I am not asking for grid

– Rutvee Sojitra
Jul 9 at 9:22













@RutveeSojitra is it working for you?

– Rohan Hapani
Jul 15 at 4:42





@RutveeSojitra is it working for you?

– Rohan Hapani
Jul 15 at 4:42










1 Answer
1






active

oldest

votes


















0














Try to use this below code :




app/code/RH/SalesCustom/etc/module.xml




<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="RH_SalesCustom" >
<sequence>
<module name="Magento_Sales"/>
</sequence>
</module>
</config>



app/code/RH/SalesCustom/registration.php




<?php

use MagentoFrameworkComponentComponentRegistrar;

ComponentRegistrar::register(
ComponentRegistrar::MODULE,
'RH_SalesCustom',
__DIR__
);



app/code/RH/SalesCustom/etc/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">
<column xsi:type="int" name="custom_sales_id" padding="10" unsigned="true" nullable="false"
comment="Custom Sales ID"/>
<constraint xsi:type="foreign" referenceId="SALES_ORDER_REFERRED_BY_SALES_ORDER_ENTITY_ID" table="sales_order"
column="custom_sales_id" referenceTable="sales_order" referenceColumn="entity_id" onDelete="CASCADE"/>
</table>
</schema>


  • custom_sales_id : your custom column name

Then run following command to generate db_schema_whitelist.json




php bin/magento setup:db-declaration:generate-whitelist




Then, upgrade command execute :




php bin/magento s:up







share|improve this answer

























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f281336%2fhow-to-add-addition-column-in-sales-order-table-using-db-schema-or-in-magento2-3%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Try to use this below code :




    app/code/RH/SalesCustom/etc/module.xml




    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="RH_SalesCustom" >
    <sequence>
    <module name="Magento_Sales"/>
    </sequence>
    </module>
    </config>



    app/code/RH/SalesCustom/registration.php




    <?php

    use MagentoFrameworkComponentComponentRegistrar;

    ComponentRegistrar::register(
    ComponentRegistrar::MODULE,
    'RH_SalesCustom',
    __DIR__
    );



    app/code/RH/SalesCustom/etc/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">
    <column xsi:type="int" name="custom_sales_id" padding="10" unsigned="true" nullable="false"
    comment="Custom Sales ID"/>
    <constraint xsi:type="foreign" referenceId="SALES_ORDER_REFERRED_BY_SALES_ORDER_ENTITY_ID" table="sales_order"
    column="custom_sales_id" referenceTable="sales_order" referenceColumn="entity_id" onDelete="CASCADE"/>
    </table>
    </schema>


    • custom_sales_id : your custom column name

    Then run following command to generate db_schema_whitelist.json




    php bin/magento setup:db-declaration:generate-whitelist




    Then, upgrade command execute :




    php bin/magento s:up







    share|improve this answer



























      0














      Try to use this below code :




      app/code/RH/SalesCustom/etc/module.xml




      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
      <module name="RH_SalesCustom" >
      <sequence>
      <module name="Magento_Sales"/>
      </sequence>
      </module>
      </config>



      app/code/RH/SalesCustom/registration.php




      <?php

      use MagentoFrameworkComponentComponentRegistrar;

      ComponentRegistrar::register(
      ComponentRegistrar::MODULE,
      'RH_SalesCustom',
      __DIR__
      );



      app/code/RH/SalesCustom/etc/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">
      <column xsi:type="int" name="custom_sales_id" padding="10" unsigned="true" nullable="false"
      comment="Custom Sales ID"/>
      <constraint xsi:type="foreign" referenceId="SALES_ORDER_REFERRED_BY_SALES_ORDER_ENTITY_ID" table="sales_order"
      column="custom_sales_id" referenceTable="sales_order" referenceColumn="entity_id" onDelete="CASCADE"/>
      </table>
      </schema>


      • custom_sales_id : your custom column name

      Then run following command to generate db_schema_whitelist.json




      php bin/magento setup:db-declaration:generate-whitelist




      Then, upgrade command execute :




      php bin/magento s:up







      share|improve this answer

























        0












        0








        0







        Try to use this below code :




        app/code/RH/SalesCustom/etc/module.xml




        <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
        <module name="RH_SalesCustom" >
        <sequence>
        <module name="Magento_Sales"/>
        </sequence>
        </module>
        </config>



        app/code/RH/SalesCustom/registration.php




        <?php

        use MagentoFrameworkComponentComponentRegistrar;

        ComponentRegistrar::register(
        ComponentRegistrar::MODULE,
        'RH_SalesCustom',
        __DIR__
        );



        app/code/RH/SalesCustom/etc/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">
        <column xsi:type="int" name="custom_sales_id" padding="10" unsigned="true" nullable="false"
        comment="Custom Sales ID"/>
        <constraint xsi:type="foreign" referenceId="SALES_ORDER_REFERRED_BY_SALES_ORDER_ENTITY_ID" table="sales_order"
        column="custom_sales_id" referenceTable="sales_order" referenceColumn="entity_id" onDelete="CASCADE"/>
        </table>
        </schema>


        • custom_sales_id : your custom column name

        Then run following command to generate db_schema_whitelist.json




        php bin/magento setup:db-declaration:generate-whitelist




        Then, upgrade command execute :




        php bin/magento s:up







        share|improve this answer













        Try to use this below code :




        app/code/RH/SalesCustom/etc/module.xml




        <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
        <module name="RH_SalesCustom" >
        <sequence>
        <module name="Magento_Sales"/>
        </sequence>
        </module>
        </config>



        app/code/RH/SalesCustom/registration.php




        <?php

        use MagentoFrameworkComponentComponentRegistrar;

        ComponentRegistrar::register(
        ComponentRegistrar::MODULE,
        'RH_SalesCustom',
        __DIR__
        );



        app/code/RH/SalesCustom/etc/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">
        <column xsi:type="int" name="custom_sales_id" padding="10" unsigned="true" nullable="false"
        comment="Custom Sales ID"/>
        <constraint xsi:type="foreign" referenceId="SALES_ORDER_REFERRED_BY_SALES_ORDER_ENTITY_ID" table="sales_order"
        column="custom_sales_id" referenceTable="sales_order" referenceColumn="entity_id" onDelete="CASCADE"/>
        </table>
        </schema>


        • custom_sales_id : your custom column name

        Then run following command to generate db_schema_whitelist.json




        php bin/magento setup:db-declaration:generate-whitelist




        Then, upgrade command execute :




        php bin/magento s:up








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jul 10 at 5:12









        Rohan HapaniRohan Hapani

        7,8494 gold badges21 silver badges65 bronze badges




        7,8494 gold badges21 silver badges65 bronze badges



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f281336%2fhow-to-add-addition-column-in-sales-order-table-using-db-schema-or-in-magento2-3%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

            Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

            Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?