How to rename third-party table from our module in Declarative Schema in Magento 2.3.0?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.1: Add Custom Upload file attribute in CheckoutMagento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsUndo preference from third party moduleMagento 2.3 : How to create product attribute via declarative schemaMagento 2. Declarative Schema. How to uninstall a patch without uninstalling the module?
How can I deal with someone that wants to kill something that isn't supposed to be killed?
How could an engineer advance human civilization by time traveling to the past?
Articles with professions
My current job follows "worst practices". How can I talk about my experience in an interview without giving off red flags?
How could Barty Crouch Jr. have run out of Polyjuice Potion at the end of the Goblet of Fire movie?
Other than a swing wing, what types of variable geometry have flown?
Are glider winch launches rarer in the USA than in the rest of the world? Why?
Do Rabbis get punished in Heaven for wrong interpretations or claims?
What happens when two cards both modify what I'm allowed to do?
The 50,000 row query limit is not actually a "per APEX call" as widely believed
How do I run a game when my PCs have different approaches to combat?
dos2unix is unable to convert typescript file to unix format
What is an Eternal Word™?
Character Frequency in a String
Area of parallelogram = Area of square. Shear transform
How to repair basic cable/wire issue for household appliances
How to write a sincerely religious protagonist without preaching or affirming or judging their worldview?
In a script how can I signal who's winning the argument?
What exactly makes a General Products hull nearly indestructible?
Who has jurisdiction for a crime committed in an embassy?
USA: Can a witness take the 5th to avoid perjury?
Inadvertently nuked my disk permission structure - why?
Can I pay with HKD in Macau or Shenzhen?
Considerations when providing money to one child now, and the other later?
How to rename third-party table from our module in Declarative Schema in Magento 2.3.0?
How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.1: Add Custom Upload file attribute in CheckoutMagento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsUndo preference from third party moduleMagento 2.3 : How to create product attribute via declarative schemaMagento 2. Declarative Schema. How to uninstall a patch without uninstalling the module?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I wanted to rename table ThirdParty
to NewTable
So I wrote the following code:
<?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="ThirdParty" disabled="true" />
<table name="NewTable" onCreate="migrateDataFromAnotherTable(ThirdParty)">
<column name="id" xsi:type="int" identity="true" />
<column name="code" xsi:type="varchar" length="4"/>
<column name="title" xsi:type="text"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="id" />
</constraint>
</table>
</schema>
After setup:upgrade
it is showing error as,
Element 'table', attribute 'disabled': The attribute 'disabled' is not
allowed. Line: 4
magento2 attributes declarative-schema
add a comment |
I wanted to rename table ThirdParty
to NewTable
So I wrote the following code:
<?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="ThirdParty" disabled="true" />
<table name="NewTable" onCreate="migrateDataFromAnotherTable(ThirdParty)">
<column name="id" xsi:type="int" identity="true" />
<column name="code" xsi:type="varchar" length="4"/>
<column name="title" xsi:type="text"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="id" />
</constraint>
</table>
</schema>
After setup:upgrade
it is showing error as,
Element 'table', attribute 'disabled': The attribute 'disabled' is not
allowed. Line: 4
magento2 attributes declarative-schema
add a comment |
I wanted to rename table ThirdParty
to NewTable
So I wrote the following code:
<?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="ThirdParty" disabled="true" />
<table name="NewTable" onCreate="migrateDataFromAnotherTable(ThirdParty)">
<column name="id" xsi:type="int" identity="true" />
<column name="code" xsi:type="varchar" length="4"/>
<column name="title" xsi:type="text"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="id" />
</constraint>
</table>
</schema>
After setup:upgrade
it is showing error as,
Element 'table', attribute 'disabled': The attribute 'disabled' is not
allowed. Line: 4
magento2 attributes declarative-schema
I wanted to rename table ThirdParty
to NewTable
So I wrote the following code:
<?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="ThirdParty" disabled="true" />
<table name="NewTable" onCreate="migrateDataFromAnotherTable(ThirdParty)">
<column name="id" xsi:type="int" identity="true" />
<column name="code" xsi:type="varchar" length="4"/>
<column name="title" xsi:type="text"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="id" />
</constraint>
</table>
</schema>
After setup:upgrade
it is showing error as,
Element 'table', attribute 'disabled': The attribute 'disabled' is not
allowed. Line: 4
magento2 attributes declarative-schema
magento2 attributes declarative-schema
edited Jul 15 at 13:01
Raj Mohan R
1,6993 silver badges13 bronze badges
1,6993 silver badges13 bronze badges
asked Jul 15 at 10:30
Shweta LambhateShweta Lambhate
61 bronze badge
61 bronze badge
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You can achieve this by following code,
<table name="NewTable" onCreate="migrateDataFromAnotherTable(ThirdParty)">
Your code is also true, just need to remove this line,
<table name="ThirdParty" disabled="true" />
Run Command
php bin/magento setup:upgrade
It creates "NewTable" but don't delete "Thirdparty" table. So we get 2 tables "NewTable" and "Thirdparty".
– Shweta Lambhate
Jul 15 at 11:48
did you regenerate the db_schema_whitelist.json file by this commandphp bin/magento setup:db-declaration:generate-whitelist –module-name=Vendorname_Packagename
? so it contains the new name in addition to the old one.
– Mohit Rane
Jul 15 at 11:54
Yes, I generated whitelist files, but as we can rename column by 2 ways: 1) disabled=1 (which don't work with table) 2)Replace column name with new name (which can't do directly on third party table). So, though we generatee whitelist and use onCreate, the code for "ThirdParty" table exist in ThirdParty module and thus the table exist at the end.
– Shweta Lambhate
Jul 16 at 5:12
we're renaming the table as defined in this docs devdocs.magento.com/guides/v2.3/extension-dev-guide/…
– Mohit Rane
Jul 16 at 6:11
@ShwetaLambhate why don't you writeInstallSchema.php
orUpgradeSchema.php
file, you can easily rename table with that.
– Mohit Rane
Jul 16 at 6:34
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%2f282091%2fhow-to-rename-third-party-table-from-our-module-in-declarative-schema-in-magento%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
You can achieve this by following code,
<table name="NewTable" onCreate="migrateDataFromAnotherTable(ThirdParty)">
Your code is also true, just need to remove this line,
<table name="ThirdParty" disabled="true" />
Run Command
php bin/magento setup:upgrade
It creates "NewTable" but don't delete "Thirdparty" table. So we get 2 tables "NewTable" and "Thirdparty".
– Shweta Lambhate
Jul 15 at 11:48
did you regenerate the db_schema_whitelist.json file by this commandphp bin/magento setup:db-declaration:generate-whitelist –module-name=Vendorname_Packagename
? so it contains the new name in addition to the old one.
– Mohit Rane
Jul 15 at 11:54
Yes, I generated whitelist files, but as we can rename column by 2 ways: 1) disabled=1 (which don't work with table) 2)Replace column name with new name (which can't do directly on third party table). So, though we generatee whitelist and use onCreate, the code for "ThirdParty" table exist in ThirdParty module and thus the table exist at the end.
– Shweta Lambhate
Jul 16 at 5:12
we're renaming the table as defined in this docs devdocs.magento.com/guides/v2.3/extension-dev-guide/…
– Mohit Rane
Jul 16 at 6:11
@ShwetaLambhate why don't you writeInstallSchema.php
orUpgradeSchema.php
file, you can easily rename table with that.
– Mohit Rane
Jul 16 at 6:34
add a comment |
You can achieve this by following code,
<table name="NewTable" onCreate="migrateDataFromAnotherTable(ThirdParty)">
Your code is also true, just need to remove this line,
<table name="ThirdParty" disabled="true" />
Run Command
php bin/magento setup:upgrade
It creates "NewTable" but don't delete "Thirdparty" table. So we get 2 tables "NewTable" and "Thirdparty".
– Shweta Lambhate
Jul 15 at 11:48
did you regenerate the db_schema_whitelist.json file by this commandphp bin/magento setup:db-declaration:generate-whitelist –module-name=Vendorname_Packagename
? so it contains the new name in addition to the old one.
– Mohit Rane
Jul 15 at 11:54
Yes, I generated whitelist files, but as we can rename column by 2 ways: 1) disabled=1 (which don't work with table) 2)Replace column name with new name (which can't do directly on third party table). So, though we generatee whitelist and use onCreate, the code for "ThirdParty" table exist in ThirdParty module and thus the table exist at the end.
– Shweta Lambhate
Jul 16 at 5:12
we're renaming the table as defined in this docs devdocs.magento.com/guides/v2.3/extension-dev-guide/…
– Mohit Rane
Jul 16 at 6:11
@ShwetaLambhate why don't you writeInstallSchema.php
orUpgradeSchema.php
file, you can easily rename table with that.
– Mohit Rane
Jul 16 at 6:34
add a comment |
You can achieve this by following code,
<table name="NewTable" onCreate="migrateDataFromAnotherTable(ThirdParty)">
Your code is also true, just need to remove this line,
<table name="ThirdParty" disabled="true" />
Run Command
php bin/magento setup:upgrade
You can achieve this by following code,
<table name="NewTable" onCreate="migrateDataFromAnotherTable(ThirdParty)">
Your code is also true, just need to remove this line,
<table name="ThirdParty" disabled="true" />
Run Command
php bin/magento setup:upgrade
answered Jul 15 at 11:19
Mohit RaneMohit Rane
90717 bronze badges
90717 bronze badges
It creates "NewTable" but don't delete "Thirdparty" table. So we get 2 tables "NewTable" and "Thirdparty".
– Shweta Lambhate
Jul 15 at 11:48
did you regenerate the db_schema_whitelist.json file by this commandphp bin/magento setup:db-declaration:generate-whitelist –module-name=Vendorname_Packagename
? so it contains the new name in addition to the old one.
– Mohit Rane
Jul 15 at 11:54
Yes, I generated whitelist files, but as we can rename column by 2 ways: 1) disabled=1 (which don't work with table) 2)Replace column name with new name (which can't do directly on third party table). So, though we generatee whitelist and use onCreate, the code for "ThirdParty" table exist in ThirdParty module and thus the table exist at the end.
– Shweta Lambhate
Jul 16 at 5:12
we're renaming the table as defined in this docs devdocs.magento.com/guides/v2.3/extension-dev-guide/…
– Mohit Rane
Jul 16 at 6:11
@ShwetaLambhate why don't you writeInstallSchema.php
orUpgradeSchema.php
file, you can easily rename table with that.
– Mohit Rane
Jul 16 at 6:34
add a comment |
It creates "NewTable" but don't delete "Thirdparty" table. So we get 2 tables "NewTable" and "Thirdparty".
– Shweta Lambhate
Jul 15 at 11:48
did you regenerate the db_schema_whitelist.json file by this commandphp bin/magento setup:db-declaration:generate-whitelist –module-name=Vendorname_Packagename
? so it contains the new name in addition to the old one.
– Mohit Rane
Jul 15 at 11:54
Yes, I generated whitelist files, but as we can rename column by 2 ways: 1) disabled=1 (which don't work with table) 2)Replace column name with new name (which can't do directly on third party table). So, though we generatee whitelist and use onCreate, the code for "ThirdParty" table exist in ThirdParty module and thus the table exist at the end.
– Shweta Lambhate
Jul 16 at 5:12
we're renaming the table as defined in this docs devdocs.magento.com/guides/v2.3/extension-dev-guide/…
– Mohit Rane
Jul 16 at 6:11
@ShwetaLambhate why don't you writeInstallSchema.php
orUpgradeSchema.php
file, you can easily rename table with that.
– Mohit Rane
Jul 16 at 6:34
It creates "NewTable" but don't delete "Thirdparty" table. So we get 2 tables "NewTable" and "Thirdparty".
– Shweta Lambhate
Jul 15 at 11:48
It creates "NewTable" but don't delete "Thirdparty" table. So we get 2 tables "NewTable" and "Thirdparty".
– Shweta Lambhate
Jul 15 at 11:48
did you regenerate the db_schema_whitelist.json file by this command
php bin/magento setup:db-declaration:generate-whitelist –module-name=Vendorname_Packagename
? so it contains the new name in addition to the old one.– Mohit Rane
Jul 15 at 11:54
did you regenerate the db_schema_whitelist.json file by this command
php bin/magento setup:db-declaration:generate-whitelist –module-name=Vendorname_Packagename
? so it contains the new name in addition to the old one.– Mohit Rane
Jul 15 at 11:54
Yes, I generated whitelist files, but as we can rename column by 2 ways: 1) disabled=1 (which don't work with table) 2)Replace column name with new name (which can't do directly on third party table). So, though we generatee whitelist and use onCreate, the code for "ThirdParty" table exist in ThirdParty module and thus the table exist at the end.
– Shweta Lambhate
Jul 16 at 5:12
Yes, I generated whitelist files, but as we can rename column by 2 ways: 1) disabled=1 (which don't work with table) 2)Replace column name with new name (which can't do directly on third party table). So, though we generatee whitelist and use onCreate, the code for "ThirdParty" table exist in ThirdParty module and thus the table exist at the end.
– Shweta Lambhate
Jul 16 at 5:12
we're renaming the table as defined in this docs devdocs.magento.com/guides/v2.3/extension-dev-guide/…
– Mohit Rane
Jul 16 at 6:11
we're renaming the table as defined in this docs devdocs.magento.com/guides/v2.3/extension-dev-guide/…
– Mohit Rane
Jul 16 at 6:11
@ShwetaLambhate why don't you write
InstallSchema.php
or UpgradeSchema.php
file, you can easily rename table with that.– Mohit Rane
Jul 16 at 6:34
@ShwetaLambhate why don't you write
InstallSchema.php
or UpgradeSchema.php
file, you can easily rename table with that.– Mohit Rane
Jul 16 at 6:34
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%2f282091%2fhow-to-rename-third-party-table-from-our-module-in-declarative-schema-in-magento%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