bolt / core

🧿 Bolt 5 core
https://boltcms.io
MIT License
538 stars 160 forks source link

Incorrect table definition error running composer update #2502

Open peterboorsma opened 3 years ago

peterboorsma commented 3 years ago

I'm running into update errors in Bolt 5.

After running composer update I get the following message.

Trying to install assets as relative symbolic links.
 --- ------------------------ ------------------
      Bundle                   Method / Error
 --- ------------------------ ------------------
  βœ”   ApiPlatformBundle        relative symlink
  βœ”   BabDevPagerfantaBundle   relative symlink
  βœ”   TranslationBundle        relative symlink
 --- ------------------------ ------------------
 [OK] All assets were successfully installed.

With an error:

 [ERROR] Out-of-date! 1 migration is available to execute.
 [WARNING] Please run `php bin/console doctrine:migrations:migrate` to execute the database migrations.

So I run php bin/console doctrine:migrations:migrate and get this message:

[notice] Migrating up to Bolt\DoctrineMigrations\Version20201210105836
[error] Migration Bolt\DoctrineMigrations\Version20201210105836 failed during Execution. Error: "An exception occurred while executing 'CREATE TABLE bolt_password_request (user_id INT DEFAULT 0 NOT NULL, id INT AUTO_INCREMENT NOT NULL, INDEX IDX_AFC1BF6FA76ED395 (user_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB':
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"
 An exception occurred while executing 'CREATE TABLE bolt_password_request (user_id INT DEFAULT 0 NOT NULL, id I
  NT AUTO_INCREMENT NOT NULL, INDEX IDX_AFC1BF6FA76ED395 (user_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb
  4_unicode_ci` ENGINE = InnoDB':
  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

Now I try bin/console doctrine:schema:update --force I get this message: 1 query was executed Trying php bin/console doctrine:migrations:migrate again only to get this message:

An exception occurred while executing 'CREATE TABLE bolt_password_request (user_id INT DEFAULT 0 NOT N
  ULL, id INT AUTO_INCREMENT NOT NULL, INDEX IDX_AFC1BF6FA76ED395 (user_id)) DEFAULT CHARACTER SET utf8m
  b4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB':
  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
In Exception.php line 18:
  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
In PDOConnection.php line 132:
  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

So something seems wrong but it does noet break stuff, I can work in Bolt without problems.


Bolt 5.0.0 beta 3

System Information:

Install type: Packaged distribution
Database: mysql 5.7.32 - 127.0.0.1 via TCP/IP
PHP version: 7.4.15
Symfony version: v5.2.6
Operating System: Darwin - 20.3.0
Assets version: 4.1.99.9
bobdenotter commented 3 years ago

If your DB is already up-to-date, but the notice is still showing, you can run the following:

bin/console doctrine:schema:update -v --dump-sql --force --complete
bin/console doctrine:migrations:sync-metadata-storage -q
bin/console doctrine:migrations:version --add --all -n -q