I just try to override db_schema.xml
file of a core customer module into my custom module , but there is no success.
I need to remove a constraint defined in customer db_schema.xml
file, how may I do that.
Thanks
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityAfter setting disabled="true"
to the constraint, run generate whitelist command and upgrade.
<?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="customer_entity">
<constraint xsi:type="unique" referenceId="CUSTOMER_ENTITY_EMAIL_WEBSITE_ID" disabled="true" />
</table>
</schema>
<table>
, you only need the name
attribute. For the constraint, only xsi:type
, referenceId
and disable
. You don't need to copy all those other attributes.
May 1, 2020 at 18:07
I had to disable the constraint below and this is how I solved it:
<?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="company_configurator_configurations" resource="default"
...
<constraint xsi:type="foreign" referenceId="COMPANY_CONFIGURATOR_CONFIGURATIONS_QUOTE_ITEM_ID_QUOTE_ITEM_ITEM_ID"
table="company_configurator_configurations"
column="quote_item_id"
referenceTable="quote_item"
referenceColumn="item_id"
onDelete="CASCADE"
/>
...
disabled="true"
:<?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="company_configurator_configurations" resource="default"
...
<constraint xsi:type="foreign" referenceId="COMPANY_CONFIGURATOR_CONFIGURATIONS_QUOTE_ITEM_ID_QUOTE_ITEM_ITEM_ID"
table="company_configurator_configurations"
column="quote_item_id"
referenceTable="quote_item"
referenceColumn="item_id"
onDelete="CASCADE"
disabled="true"
/>
...
bin/magento setup:db-declaration:generate-whitelist --module-name=Company_Configurator
bin/magento setup:upgrade --keep-generated
vendor\module-customer\etc\db_schema.xml
to my custom moulde<NAMESPACE>\<MODULE>\etc\db_schema.xml
and did necessary changes regardingconstrants
, is any thing else I need to do ?