2

I've got this error when run "bin/magento setup:upgrade".

Module 'Magento_Catalog':
Running schema recurring...

  [PDOException]                                                                                        
  SQLSTATE[HY000]: General error: 1826 Duplicate foreign key constraint name 'mydb/CAT_CTGR_PRD_CTGR_ID_CAT_CTGR_ENTT_ENTT_ID'

What can cause it?

4

run command: php bin/magento setup:db-declaration:generate-whitelist

It resolves the issue for me

0

Same issue there, it seems that my columns declaration don't match (between the reference table and the table owning the foreign key), for example: one is unsigned and not the other, or one is nullable or not the other.

I didn't find a way to solve it yet, except by making these columns match (which is not what I want, for example to have a nullable foreign key).

What I don't understand is that Magento's core succeed in doing this, cf. tables store and customer_entity, where store_id column is nullable.

[Edit] It seems that generating a db_schema_whitelist.json with command bin/magento setup:db-declaration:generate-whitelist --module-name=My_Module solved it, didn't exactly understood why, if anyone has an explanation I would be grateful!

  • Too bad I cannot confirm if this worked for me or not. – TheKitMurkit Feb 25 '19 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.