Jira issue originally created by user @beberlei:
JPA specifies a field to be nullable by default, however $classMetadata->isNullable('fieldName') on a field which has no 'nullable' key returns false.
This leads to strange errors, SchemaTool createSQL assumes like JPA that fields are nullable by default. However updateSchemaSql uses isNullable which assumes the opposite.
This can lead to situations there is always a ALTER TABLE NOT NULL is suggested by the SchemaTool, although this is already set, only because the 'nullable' key is not set in the metadata of an entity.
Comment created by @beberlei:
Attached is a patch.
Comment created by romanb:
As far as I can remember normal columns (@Column) should be not nullable (nullable = false) by default and join columns the other way around. I know this is different from the spec but its much more in-line with common usage. Nullable columns are pretty rare in practice and indeed usually discouraged. For foreign keys on the other hand it is obvious that when the association is optional the foreign key must be nullable. And since all associations are optional by default, join columns should be nullable by default.
In this case I will fix createSql() assuming notnull = false in SchemaTool, which is a bugfix nevertheless :-)
Fixed, Assumption is now that nullable = false
Issue was closed with resolution "Fixed"
Imported 1 attachments from Jira into https://gist.github.com/4e008a7b8ede5104ae04