doctrine / DoctrineMigrationsBundle

Symfony integration for the doctrine/migrations library
MIT License
4.21k stars 215 forks source link

Table migration_versions wants to be deleted after updating to Symfony 7.1 #554

Open dmitryuk opened 1 month ago

dmitryuk commented 1 month ago

After updating the to Symfony 7.1 Command bin/console doctrine:schema:validate -v return an error:

 [ERROR] The database schema is not in sync with the current mapping file.                                              

 // 1 schema diff(s) detected:                                                                                          

     DROP TABLE migration_versions;

I tried to filter the table, but migration command fails

orm:
    dbal:
      ...
       schema_filter: ~^(?!migration_versions)~

//   SQLSTATE[42P07]: Duplicate table: 7 ERROR:  relation "migration_versions" already exists  

Any help needed

UPD: found that \Doctrine\DBAL\Schema\SchemaDiff::toSaveSql after updating DBAL changed variable saveMode from false to true and the code below is evaluated:

        if ($saveMode === false) {
            $sql = array_merge($sql, $platform->getDropTablesSQL($this->getDroppedTables()));
        }
dmitryuk commented 1 month ago

Related https://github.com/doctrine/migrations/issues/1406#issuecomment-2001943937