Jira issue originally created by user darkangel:
With the following entities ...\
* @JoinColumn(name="role_id", nullable=false)
/*** @Column(type="string", columnDefinition="CHAR(64) NOT NULL") **/
I'm getting this output from orm:schema-tool:update --dump-sql, when the database is already up-to-date:
```ALTER TABLE users CHANGE password password CHAR(64) NOT NULL;
ALTER TABLE users DROP FOREIGN KEY users*ibfk*1;
ALTER TABLE users ADD FOREIGN KEY (role_id) REFERENCES roles(id)```
Comment created by shurakai:
This is most probably equivalent with the following problem:
It's got to do with cli: when you DB is up to date and you run orm:schema-tool:update --dump-sql, you get something like this:
ALTER TABLE user_users CHANGE avatar avatar LONGTEXT NOT NULL <- but the column avatar is already LONGTEXT
This is caused by the following: Two schema objects are being compared. The first schema is created from the current mapping files (YAML, e.g.) and within these, this column is marked as "object". When the DB is setup, object is transferred into another type, like LONGTEXT. (Platform dependent)
The second schema is created from your current database and is marked as "TextType" because Doctrine cannot decide which other type - there are several who use LONGTEXT - would be correct
See /DBAL/Schema/Comparator.php ll. 172ff. & 293
Comparing whether both Types return the same SQL-Statement might do the job but would be really ugly.
Comment created by @beberlei:
The columnDefintion affected field can obviously not be solved by any means.
The foreign key thing i see more often in my own projects though, i have to dig deeper there.
Fixed Foreign Key issue in DBAL master, it was an error in the MySQL query to fetch the foreign keys.
Issue was closed with resolution "Fixed"