Jira issue originally created by user olegk:
I have a field which I want to be mysql mediumtext
/**
* @var string $description
*
* @ORM\Column(name="description", type="string", length=65536)
*/
private $description;
Everything is fine, field created as 'mediumtext'
but whenever I run
php app/console doctrine:schema:update --dump-sql
I get
ALTER TABLE table CHANGE description description MEDIUMTEXT NOT NULL;
though description is MEDIUMTEXT already.
Comment created by @guilhermeblanco:
Issue seems to be fixed already in master.
Coverage test:
https://github.com/doctrine/dbal/commit/4030787aa178b5c85d4717a75c43eb122edbd68d
Issue was closed with resolution "Fixed"
I still have the exact same issue with orm 2.7.1, dbal 2.10.1
/**
* @ORM\Column(type="string", length=16777215, nullable=false)
* @Assert\Length(max=16777215)
* @Assert\NotBlank()
*/
private $content;
show create table:
`content` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
php bin/console doctrine:schema:update --dump-sql:
ALTER TABLE messages CHANGE content content MEDIUMTEXT NOT NULL;
The same if I change length to 65536 or I remove nullable=false.
For anyone running into the same issue as @fmonts:
Use type="text" instead of type="string", i.e.:
@ORM\Column(type="text", length=16777215, nullable=false)
Most helpful comment
For anyone running into the same issue as @fmonts:
Use
type="text"instead oftype="string", i.e.:@ORM\Column(type="text", length=16777215, nullable=false)