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?
401k investment after being fired. Do I own it?
Monty Hall Problem with a Fallible Monty
What is the meaning of "you has the wind of me"?
What would be the side effects on the life of a person becoming indestructible?
Is it possible to build or embed the SMILES representation of compounds in 3D?
Why do people say "I am broke" instead of "I am broken"?
Extrapolation v. Interpolation
What was the rationale behind 36 bit computer architectures?
My current job follows "worst practices". How can I talk about my experience in an interview without giving off red flags?
Where is this photo of a group of hikers taken? Is it really in the Ural?
Raw curve25519 public key points
Character Frequency in a String
Sci-fi short story: plants attracting spaceship and using them as a agents of pollination between two planets
Why is a dedicated QA team member necessary?
what to say when a company asks you why someone (a friend) who was fired left?
How to write a sincerely religious protagonist without preaching or affirming or judging their worldview?
What exactly makes a General Products hull nearly indestructible?
Why are there not any MRI machines available in Interstellar?
The seven story archetypes. Are they truly all of them?
What is an Eternal Word™?
Is it OK to accept a job opportunity while planning on not taking it?
What do I do when a student working in my lab "ghosts" me?
How can the artificial womb be made affordable for the common people?
"It is what it is" in French
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
87417 bronze badges
87417 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