migrations icon indicating copy to clipboard operation
migrations copied to clipboard

Bug in generating migration for MEDIUMBLOB field (type="binary", length=16777215)

Open vyshkant opened this issue 4 years ago • 0 comments

Bug Report

Q A
BC Break no
Version 3.0.2

Summary

Doctrine generates migration when there are no mapping changes, up and down are identical.

Current behavior

Doctrine continues to generate migrations with identical up and down methods.

How to reproduce

  1. Create an entity containing the next field mapping:
    /**
     * @var string|null
     *
     * @ORM\Column(type="binary", length=16777215, nullable=true)
     */
    private $binaryContent;
  1. Apply this mapping to the database (MySQL) somehow (with migrations or in any other way, it doesn't matter).

  2. After the mapping is applied, run bin/console doctrine:migrations:diff.

  3. Take a look at the generated code:

    public function up(Schema $schema) : void
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE file CHANGE binary_content binary_content MEDIUMBLOB DEFAULT NULL');
    }

    public function down(Schema $schema) : void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE file CHANGE binary_content binary_content MEDIUMBLOB DEFAULT NULL');
    }

These code blocks are just the same.

Expected behavior

No migration generated, as there were not mapping changes.

vyshkant avatar Jan 17 '21 22:01 vyshkant