Skip to content
Advertisement

Doctrine 2 + unsigned value

Is it possible to specify a column type of unsigned integer in Doctrine 2?

Advertisement

Answer

You can but you will loose portability. Use columnDefinition attribute and set it to integer unsigned. The actual code depends on what you are using.

columnDefinition: 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”.

Doctrine reference: https://www.doctrine-project.org/projects/doctrine-orm/en/latest/reference/annotations-reference.html#column

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement