doctrine/DoctrineMigrationsBundle

doctrine:migrations:diff generates diff for the field with enumType

Santttal opened this issue · 6 comments

Hi all!

I have an Entity

/**
 * @ORM\Entity
 * @ORM\Table(
 *     name="daily_sale_aggregations"
 * )
 */
class DailyAggregation implements Entity
{
    /**
     * @ORM\Column(type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private int $id;
    
    /**
     * @ORM\Column(type="string", enumType="Planning\Application\Enum\SaleTypeEnum", options={"default" : "total"})
     */
    private SaleTypeEnum $saleType;
}

And whem I run bin/console doctrine:migrations:diff I always have new migration created:

    public function up(Schema $schema): void
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE daily_sale_aggregations CHANGE sale_type sale_type VARCHAR(255) DEFAULT \'total\' NOT NULL');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE daily_sale_aggregations CHANGE sale_type sale_type VARCHAR(255) CHARACTER SET utf8 DEFAULT \'total\' NOT NULL COLLATE `utf8_unicode_ci`');
    }

Libraries used
"doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/orm": "^2.11"

Is it an issue or I'm doing something wrong?

Is this a duplicate of doctrine/migrations#1240 ?

Is this a duplicate of doctrine/migrations#1240 ?

Not sure about duplicate but can be related

vitxd commented

ehi, sorry to comment on a closed issue but if this comment is true (doctrine/migrations#1240 (comment)) then this issue is not a duplicate.

I have the same issue.

Hi @ostrolucky, could you reopen this? It is sad that you have closed the issue without verifying that it was fixed. I observe the same issue. DoctrineBundle 2.7, Dbal 2.13.9. Please follow the original report to reproduce it.

stof commented

@EgorBurykin The schema comparison logic is part of DBAL. And DBAL 2.13 is far from being uptodate (and will soon be end-of-life, see https://www.doctrine-project.org/2022/01/22/sunsetting-dbal-2.html)