Doctrine migrations:diff regenerates same unique index constraint

  doctrine, doctrine-migrations, doctrine-orm, php, symfony

I have a weird problem. When I run doctrine-migrations migrations:diff it regenerates the index that already is set in an earlier migration.

Earlier migration (the uniq index is also present in my database):

$this->addSql('CREATE TABLE my_table (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_4FBF094FE7927C74 (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');

Regenerated after running doctrine-migrations migrations:diff:

$this->addSql('DROP INDEX uniq_4vbv083va6917b55 ON my_table');
$this->addSql('CREATE UNIQUE INDEX UNIQ_J43107ECE6416I64 ON contact_company (email)');

I’ve defined the unique constraint like this in my entity:

 * @ORMColumn(type="string", unique=true)
private string $email;

Source: Symfony Questions