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;
How to add addition column in sales_order table using db_schema or in Magento2.3.1 best way?
magento2 database-schema datatable
add a comment |
How to add addition column in sales_order table using db_schema or in Magento2.3.1 best way?
magento2 database-schema datatable
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
add a comment |
How to add addition column in sales_order table using db_schema or in Magento2.3.1 best way?
magento2 database-schema datatable
How to add addition column in sales_order table using db_schema or in Magento2.3.1 best way?
magento2 database-schema datatable
magento2 database-schema datatable
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
add a comment |
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
add a comment |
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
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
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
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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