orm icon indicating copy to clipboard operation
orm copied to clipboard

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

Open aelfannir opened this issue 3 months ago • 0 comments

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: 
* All tables related to my entities got removed, except one (vendor_offer_product here)
* When I renamed VendorOfferProduct entity to FakeEntity, the generated migration drops vendor_offer_product and create other table vendor_offer (from VendorOffer)


#### Current behavior
#### How to reproduce
#### Expected behavior

aelfannir avatar May 03 '24 12:05 aelfannir