0

I just recently upgraded from Magento 2.3 to Magento 2.3.3 and whenever I'm trying to run php bin/magento setup:upgrade SSH command it just stick on Unique constraint violation found. Any idea how do I fix this ?

Error after running the php bin/magento setup:db-data:upgrade SSH command:

    In AbstractDb.php line 427:

  Unique constraint violation found  


In Mysql.php line 593:

  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '  
  order-0' for key 'SALES_SEQUENCE_META_ENTITY_TYPE_STORE_ID', query was:  
   INSERT INTO `mg_sales_sequence_meta` (`entity_type`, `store_id`, `sequ  
  ence_table`) VALUES (?, ?, ?)                                            


In Mysql.php line 110:

  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '  
  order-0' for key 'SALES_SEQUENCE_META_ENTITY_TYPE_STORE_ID', query was:  
   INSERT INTO `mg_sales_sequence_meta` (`entity_type`, `store_id`, `sequ  
  ence_table`) VALUES (?, ?, ?)                                            


In Mysql.php line 91:

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


setup:db-data:upgrade [--magento-init-params MAGENTO-INIT-PARAMS]

enter image description here

enter image description here

1

"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

0

I deleted the :

**order-0
Invoice-0
creditmemo-0
Shipment-0
wrlcw_trx-0
Order-1
Invoice-1
Creditmemo-1
Shipment-1
wrlcw_trx-1**

From mg_sales_sequence_meta and it fixed the error for me.

enter image description here

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.