dotmailer / dotmailer-magento2-extension

The official Dotdigital for Magento2 extension
https://dotdigital.com/integrations/magento
MIT License
48 stars 64 forks source link

wrong constraint in db_schema.xml #589

Closed okolya closed 1 year ago

okolya commented 1 year ago

The command bin/magento setup:db:status

Declarative Schema is not up to date
Run 'setup:upgrade' to update your DB schema and data.

I have found that the foreign key could not be updated for the table and key EMAIL_CATALOG_PRODUCT_ID_CATALOG_PRODUCT_ENTITY_ENTITY_ID.

I tested with magento enterprise 2.4.3-p1.

It could be debugged in Magento\Framework\Setup\Declaration\Schema\UpToDateDeclarativeSchema::isUpToDate()

okolya commented 1 year ago

similar bug could be here https://magento.stackexchange.com/questions/341484/magento2-what-is-the-purpose-of-email-catalog-table

okolya commented 1 year ago

The fix should be to disable EMAIL_CATALOG_PRODUCT_ID_CATALOG_PRODUCT_ENTITY_ENTITY_ID in new module 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="email_catalog" resource="default" comment="Connector Catalog">
        <constraint xsi:type="foreign" referenceId="EMAIL_CATALOG_PRODUCT_ID_CATALOG_PRODUCT_ENTITY_ENTITY_ID" disabled="1"/>
    </table>
</schema>

db_schema_whitelist.json

{
    "email_catalog": {
        "constraint": {
            "EMAIL_CATALOG_PRODUCT_ID_CATALOG_PRODUCT_ENTITY_ENTITY_ID": true
        }
    }
}
sertlab commented 1 year ago

Hi @okolya and thanks for raising this. Could you please tell us what is the version of the Dotdigitalgroup_Email module that you currently experience this? Also it would be useful to provide us full repro steps in order to help us replicate the issue locally Thanks
Fanis

sta1r commented 1 year ago

@okolya Thanks again for flagging this one. Fixed as suggested by adding a disabled constraint to our Enterprise module: https://github.com/dotmailer/dotmailer-magento2-extension-enterprise/releases/tag/v1.10.1.