Bug #68147 "Synchronize model" fails for table with UNSIGNED INT usertype PK
Submitted: 22 Jan 2013 18:55 Modified: 23 Jan 2013 14:07
Reporter: Rasmus Schultz Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench: Administration Severity:S2 (Serious)
Version:5.2.45CE OS:Windows
Assigned to: CPU Architecture:Any

[22 Jan 2013 18:55] Rasmus Schultz
Description:
With a usertype defined as UNSIGNED INT being used for the primary key of a table, the "Synchronize model" function attempts to ALTER the primary key every time, leading to failure.

How to repeat:
1. Start a new project.
2. Open the User Defined Types dialog.
3. Add a new Type - name it "UINT", set the type to "INT" and check the "UNSIGNED" option.
4. Apply and Close the dialog.
5. Create a new diagram and add a new table named "person".
6. Add a primary key column named "id" and set the type to "UINT".
7. Add a VARCHAR column called "name".
8. Run "Forward Engineer" to create the database.
9. Run "Synchronize Model" and continue through the wizard to the dialog that shows the differences.
10. Select the "person" table and review the changes.

Although this was just created and no changes were made, you will now see an ALTER TABLE statement similar to:

ALTER TABLE `test`.`person` CHANGE COLUMN `id` `id` INT(11) NOT NULL  

This should correctly read:

ALTER TABLE `test`.`person` CHANGE COLUMN `id` `id` INT(11) UNSIGNED NOT NULL  

(of course, this should not register as a change in the first place, since you just created the table and no changes were made.)

Note that "Forward Engineer" does correctly create the id-column as UNSIGNED initially.
[22 Jan 2013 18:55] Rasmus Schultz
Example project demonstrating the issue

Attachment: usertype-pk-bug.mwb (application/octet-stream, text), 5.86 KiB.

[23 Jan 2013 14:07] MySQL Verification Team
Thank you for the bug report. Related to same issue:

http://bugs.mysql.com/bug.php?id=67853