when I execute "php bin/magento setup:upgrade"

I got this error: enter code hereCache cleared successfully File system cleanup:

/var/www/magento-ci/generated/code/Amazon /var/www/magento-ci/generated/code/Composer /var/www/magento-ci/generated/code/DOMDocumentFactory.php /var/www/magento-ci/generated/code/Dotdigitalgroup /var/www/magento-ci/generated/code/Klarna /var/www/magento-ci/generated/code/MSP /var/www/magento-ci/generated/code/Magento /var/www/magento-ci/generated/code/Symfony /var/www/magento-ci/generated/code/Temando /var/www/magento-ci/generated/code/Vertex /var/www/magento-ci/generated/code/Yotpo /var/www/magento-ci/generated/metadata/adminhtml.php /var/www/magento-ci/generated/metadata/crontab.php /var/www/magento-ci/generated/metadata/frontend.php /var/www/magento-ci/generated/metadata/global.php /var/www/magento-ci/generated/metadata/graphql.php /var/www/magento-ci/generated/metadata/interception.php /var/www/magento-ci/generated/metadata/webapi_rest.php /var/www/magento-ci/generated/metadata/webapi_soap.php

Updating modules: Schema creation/updates:

SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key, query was: ALTER TABLE cms_block MODIFY COLUMN block_id smallint(6) NOT NULL AUTO_INCREMENT COMMENT "Entity ID", DROP PRIMARY KEY, ADD CONSTRAINT PRIMARY KEY (block_id)

Is there anybody know the reason? thanks in advance

  • Did you imported any existing DB before executing upgrade command Commented Dec 5, 2019 at 9:53
  • same issue faced. Yes after data migration i ran setup:upgrade and got this error. Commented Dec 17, 2019 at 11:52
  • i have same issue, :(( Commented Jan 3, 2020 at 8:54
  • Please share solution here how to fixed this issue. I have facing same issue. Commented Apr 22, 2021 at 9:25
  • I have been facing the same issue can any one advise how to solve? Commented Sep 14, 2022 at 11:50

1 Answer 1


I know the reason why its happend.

You need to you use fresh database and then setup:upgrade.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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