You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changing column type from string to custom which extends string makes doctrine/migrations generate migration which drops DEFAULT NULL. It also ignores that length was not changed.
I created custom type wchich extends \Doctrine\DBAL\Types\StringType overwriting only convertToPHPValue and convertToDatabaseValue. Annotation was changed into this:
Debugging shows that default did not changed and of course type did. But comparing $column->getDefault() with null when in fact it is null and then dropping it seems odd. Removing that comparison seems to generate proper SQL:
Bug Report
Summary
Changing column type from
string
to custom which extendsstring
makesdoctrine/migrations
generate migration which dropsDEFAULT NULL
. It also ignores that length was not changed.Initial column annotation:
I created custom type wchich extends
\Doctrine\DBAL\Types\StringType
overwriting onlyconvertToPHPValue
andconvertToDatabaseValue
. Annotation was changed into this:Current behaviour
Running
doctrine:migrations:diff
command generates following SQLs:Expected behaviour
I expect that columns default value will not be changed.
Possible solution
I found this part in
\Doctrine\DBAL\Platforms\PostgreSqlPlatform
Debugging shows that
default
did not changed and of coursetype
did. But comparing$column->getDefault()
withnull
when in fact it isnull
and then dropping it seems odd. Removing that comparison seems to generate proper SQL:The text was updated successfully, but these errors were encountered: