Question

How to fix this error "Running schema recurring.Unique constraint violation found".

This statement occurs when I used upgrade command of Magento 2 model upgradation.

Was it helpful?

Solution 2

"Running schema recurring.Unique constraint violation found" this occurs if there is duplicate entry in any table of project db and high probability to occur this problem is when you export db and then import,if db is not export completely or correctly.

so the solution is just export db again correctly and import

and if you created tables then define at least one field as unique value in each table

OTHER TIPS

To see the actual error, you need to run the data upgrade command on it's own:

php bin/magento setup:db-data:upgrade

And suddenly, after many hours of searching and debugging one gets to see the actual error, which in my case looked like this:

In AbstractDb.php line 426:

Unique constraint violation found

In Mysql.php line 588:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'saferpaycw_transaction-0' for key 'SALES_SEQUENCE_META_ENTITY_TYPE_STORE_ID', query was: INSERT INTO sales_sequence_meta (entity_type, store_id, sequence_ table) VALUES (?, ?, ?)

In Pdo.php line 235:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'saferpaycw_transaction-0' for key 'SALES_SEQUENCE_META_ENTITY_TYPE_STORE_ID', query was: INSERT INTO sales_sequence_meta (entity_type, store_id, sequence_ table) VALUES (?, ?, ?)

In Pdo.php line 228:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'saferpaycw_transaction-0' for key 'SALES_SEQUENCE_META_ENTITY_TYPE_STORE_ID'

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top