doctrine migration generate update when no change has been done

Viewed 485

I use doctrine migration to update my database. I've created an entity which hold and image sotre in a mediumtext :

/**
 * Avatar of the person
 * @var string
 *
 * @ORM\Column(name="avatar", type="string", length=500000, nullable=true)
 * @Assert\NotBlank()  
 * @Assert\Length(
 *      min = 0,
 *      max = 500000,
 *      minMessage = "Avatar must be at least {{ limit }} characters long",
 *      maxMessage = "Avatar cannot be longer than {{ limit }} characters"
 * )  
 * @JMS\Groups({"user_avatar"})    
 */
 private $avatar;

So, Doctrine migration have generated this SQL to update my schema :

    $this->addSql('ALTER TABLE s_user_identity ADD avatar MEDIUMTEXT DEFAULT NULL');

But now every time I check the difference between my entities and my schema doctrine migration see a change

    $this->addSql('ALTER TABLE s_user_identity CHANGE avatar avatar MEDIUMTEXT DEFAULT NULL');

Even if a accept this migration, it will still propose me this modification of my schema.

Maybe the down can help you understand what is going on

    $this->addSql('ALTER TABLE s_user_identity CHANGE avatar avatar MEDIUMTEXT DEFAULT NULL COLLATE utf8_unicode_ci');

I also tried with doctrine:shema:update, it also see a difference. Does anyone have an idea on why doctrine does that ?

0 Answers
Related