我使用学说迁移来更新我的数据库。我创建了一个实体,它在 mediumtext 中保存和图像 sotre:
/**
* 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;
因此,Doctrine 迁移生成了这个 SQL 来更新我的架构:
$this->addSql('ALTER TABLE s_user_identity ADD avatar MEDIUMTEXT DEFAULT NULL');
但是现在每次我检查我的实体和我的模式学说迁移之间的差异时,都会看到变化
$this->addSql('ALTER TABLE s_user_identity CHANGE avatar avatar MEDIUMTEXT DEFAULT NULL');
即使接受此迁移,它仍会建议我对我的架构进行此修改。
也许羽绒可以帮助您了解发生了什么
$this->addSql('ALTER TABLE s_user_identity CHANGE avatar avatar MEDIUMTEXT DEFAULT NULL COLLATE utf8_unicode_ci');
我也试过了doctrine:shema:update
,它也看到了不同。有没有人知道为什么教义会这样做?