Skip to content

Doctrine Migration in upgrade to 5.1.0 fails #3021

@benr77

Description

@benr77

I upgrade to 5.1 with composer update and then I see the message to run the Doctrine migrations command.

When I run this command, it fails.

Details

Question Answer
Relevant Bolt Version 5.0
Install type Composer install
BC Break
PHP version 8.1
Web server Nginx

Reproduction

bin/console doctrine:migrations:migrate

 WARNING! You are about to execute a migration in database "bolt" that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:
 > 

[notice] Migrating up to Bolt\DoctrineMigrations\Version20211123103530
[error] Migration Bolt\DoctrineMigrations\Version20211123103530 failed during Execution. Error: "An exception occurred while executing 'DROP INDEX UNIQ_8B90D313A76ED395 ON bolt_user_auth_token':

SQLSTATE[HY000]: General error: 1553 Cannot drop index 'UNIQ_8B90D313A76ED395': needed in a foreign key constraint"

In AbstractMySQLDriver.php line 128:
                                                                                                                    
  An exception occurred while executing 'DROP INDEX UNIQ_8B90D313A76ED395 ON bolt_user_auth_token':                 
                                                                                                                    
  SQLSTATE[HY000]: General error: 1553 Cannot drop index 'UNIQ_8B90D313A76ED395': needed in a foreign key constrai  
  nt                                                                                                                
                                                                                                                    

In Exception.php line 18:
                                                                                                                    
  SQLSTATE[HY000]: General error: 1553 Cannot drop index 'UNIQ_8B90D313A76ED395': needed in a foreign key constrai  
  nt                                                                                                                
                                                                                                                    

In PDOConnection.php line 141:
                                                                                                                    
  SQLSTATE[HY000]: General error: 1553 Cannot drop index 'UNIQ_8B90D313A76ED395': needed in a foreign key constrai  
  nt                                                                                                                
                                                                                                                    

doctrine:migrations:migrate [--write-sql [WRITE-SQL]] [--dry-run] [--query-time] [--allow-no-migration] [--all-or-nothing [ALL-OR-NOTHING]] [--configuration CONFIGURATION] [--em EM] [--conn CONN] [--] [<version>]

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions