Hi, I've noticed multiple times I'm not able to change annotation and propagate these changes to the database.


For example changing:

/** @ORM\Column(type=“string”, length=20) */


/** @ORM\Column(type=“enum”, columnDefinition=“ENUM(‘admin’, ‘customer’)”) */

and orm:schema-tool:update –force says:

Nothing to update – your database is already in sync with the current entity metadata.


If I make some kind of workaround – I mean when I change property name $role to $role2, updating is successful. But when I rename it back to the $role with new annotation (e.g. this ‘enum’ annotation above), doctrine updates it to the previous state to the column of type ‘string’. It must be some kind of strange cache.

I tried orm:clear-cache:query, orm:clear-cache:result, orm:clear-cache:metadata, but nothing worked.

Does anyone experienced similar problem. And how to solve it?

Thanks in advance!


Remember that “enum” is not realy supported by Doctrine. Doctrine deals with “string” type and send string values to your database. This is not a problem if your Database is rightly configured with “enum” (SELECT, UPDATE, INSERT will work if your application provide the correct string values).

But for the SchemaUpdaterTool, this field stay a simple “string” type.

Now, if you look at the Doctrine documentation about “columnDefinition”, you will see: “DDL SQL snippet that starts after the column name and specifies the complete (non-portable!) column definition. This attribute allows to make use of advanced RMDBS features. However you should make careful use of this feature and the consequences. SchemaTool will not detect changes on the column correctly anymore if you use “columnDefinition”.”

So everything that you put in “columnDefinition” cannot be compared during “orm:schema-tool:update”. For him, “/** @ORM\Column(type=“enum”, columnDefinition=“ENUM(‘admin’, ‘customer’)”) */” is exactly the same has /** @ORM\Column(type=“string”) */

You must first log in to participate in this discussion