Bug #61720 Model to DB Synchronization appears to not pull default values from db
Submitted: 1 Jul 2011 16:21 Modified: 4 Sep 2012 21:04
Reporter: Csaba Skultety Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:5.2.34 OS:Windows
Assigned to: CPU Architecture:Any

[1 Jul 2011 16:21] Csaba Skultety
Description:
When synchronizing a model to a database after making a field that was originally marked as NOT NULL DEFAULT x, to NULL DEFAULT NULL, the synchronizer correctly generates the SQL that needs to be run, however, after it is run and another sync is performed, it shows that the same table needs to be updated with the same SQL.

It also appears that for a TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP it does *not* generate an alter table when the ON UPDATE portion is removed in the model, but it still exists on the server. I'm not sure if this is related or not, but it seems like maybe an issue with getting default values from the server during sync.

How to repeat:
1. Create a new model
2. Add a table (say table1) to MyDB
3. Add a column to table1 (in addition to the id field) called field1, marking the column as NOT NULL with a default 'x'
4. Forward engineer MyDB to a server
5. Edit table1 and change field1 to allow NULL and change default to NULL
6. Synchronize the model to the same server (it will correctly say that it needs to change field1 to NULL DEFAULT NULL
7. After the sync is complete, rerun the sync (without doing anything else)
8. It will again tell you that the same field needs to be updated to NULL DEFAULT NULL
[1 Jul 2011 17:34] Valeriy Kravchuk
What exact version of server, x.y.z, are you working with?
[1 Jul 2011 18:05] Csaba Skultety
5.1.41 server running on Windows and it also does it with 5.1.49 server running on ubuntu
[3 Jul 2011 1:44] MySQL Verification Team
Thank you for the bug report.
[4 Sep 2012 21:04] Philip Olson
Fixed as of the upcoming 5.2.44, and here's the changelog entry:

 When synchronizing a model to a database after changing a field definition
 from "NOT NULL DEFAULT x" to "NULL DEFAULT NULL", the 
 model synchronization would correctly generate the SQL. But after executing this
 SQL and resynchronizing, MySQL Workbench would report that the table needed
 to be updated.

Thank you for the report.