doctrine / orm

Doctrine Object Relational Mapper (ORM)
https://www.doctrine-project.org/projects/orm.html
MIT License
9.86k stars 2.5k forks source link

doctrine:migrations:diff generates DROP SEQUENCE's & DROP TABLE's for all entities except one #11435

Closed aelfannir closed 1 month ago

aelfannir commented 1 month ago

Bug Report

Q A
BC Break yes
Version 2.12.0

Summary

Whenever I create an Entity (or even an empty php file) inside /src/Entity and generate a migration, i get incorrect migration;

public function up(Schema $schema): void
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE vendor_offer_product DROP CONSTRAINT fk_fae19a339ff5ffe9');
        $this->addSql('ALTER TABLE vendor_offer_product DROP CONSTRAINT fk_fae19a336af765af');
        //
        $this->addSql('DROP SEQUENCE base_file_id_seq CASCADE');
        $this->addSql('DROP SEQUENCE bloc_id_seq CASCADE');
        $this->addSql('DROP SEQUENCE category_id_seq CASCADE');
        // continues for all entities
        $this->addSql('ALTER TABLE vendor DROP CONSTRAINT fk_f52233f6dbe15841');
        $this->addSql('ALTER TABLE product_section_budget DROP CONSTRAINT fk_6ad37b7136aba6b8');
        $this->addSql('ALTER TABLE product_section_budget DROP CONSTRAINT fk_6ad37b714b44bc51');
        $this->addSql('ALTER TABLE product_pricing DROP CONSTRAINT fk_3428b7834584665a');
        // continues for all entities
        $this->addSql('DROP TABLE vendor');
        $this->addSql('DROP TABLE base_file');
        $this->addSql('DROP TABLE company');
        $this->addSql('DROP TABLE product_section_budget');
        // continues for all entities
    }

Notes:

Current behavior

How to reproduce

Expected behavior

aelfannir commented 1 month ago

This issue isn't related to Doctrine, a filesystem issue.