Home > other >  Symfony 4.4 - Postgresql 9.6 doctrine migrating down error SQLSTATE[42P06]:
Symfony 4.4 - Postgresql 9.6 doctrine migrating down error SQLSTATE[42P06]:

Time:07-27

I can't migrating down with commande line php bin/console doctrine:migrations:migrate DoctrineMigrations\Version20220713135119

PS C:\_EnvTest\my_project_composer2> php bin/console doctrine:migrations:migrate  DoctrineMigrations\Version20220713135119     

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

[notice] Migrating down to DoctrineMigrations\Version20220713135119
[error] Migration DoctrineMigrations\Version20220718131542 failed during Execution. Error: "An exception occurred while executing a query: SQLSTATE[42P06]: Duplicate schema: 7 ERROR:  le schema « public » already exist"

In ExceptionConverter.php line 91:

  An exception occurred while executing a query: SQLSTATE[42P06]: Duplicate schema: 7 ERROR:  schema « public » already exist


In Exception.php line 30:

  SQLSTATE[42P06]: Duplicate schema: 7 ERROR:  le schema « public » already exist  


In Connection.php line 72:

  SQLSTATE[42P06]: Duplicate schema: 7 ERROR:  le schema « public » already exist

My migration :

        $this->addSql('CREATE SCHEMA public');
        $this->addSql('ALTER TABLE option_property DROP CONSTRAINT FK_AB856D7AA7C41D6F');
        $this->addSql('DROP SEQUENCE option_id_seq CASCADE');
        $this->addSql('DROP TABLE option');
        $this->addSql('DROP TABLE option_property');

CodePudding user response:

I just commented :

$this->addSql('CREATE SCHEMA public');

And run the command again and it seems to work.

github.com/doctrine/migrations/issues/494

  • Related