Bug #51491 Reverse Engineer SQL Script wizard: Does not recognise BOOLEAN data types
Submitted: 25 Feb 2010 8:51 Modified: 26 Feb 2010 9:22
Reporter: Kai Sautter (Basic Quality Contributor) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S2 (Serious)
Version:5.2.16 OS:Any
Assigned to: CPU Architecture:Any
Tags: qc

[25 Feb 2010 8:51] Kai Sautter
Description:
the Reverse Engineer SQL Script wizard does not accept the BOOL or BOOLEAN data types for columns. Columns are created but do not have a data type assigned.

How to repeat:
1) Create an SQL script with a CREATE TABLE statement for a table with a column of type BOOL or BOOLEAN
2) Reverse engineer the script using the wizard
3) Review message log
4) Check column definition of the table in the model
[26 Feb 2010 6:31] Susanne Ebrecht
Many thanks for writing a bug report.

This is problem is related to an already known server problem.

CREATE TABLE t(b1 boolean, b2 bool);

SHOW CREATE TABLE t\G
*************************** 1. row ***************************
       Table: t
Create Table: CREATE TABLE `t` (
  `b1` tinyint(1) DEFAULT NULL,
  `b2` tinyint(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.02 sec)

Because server already stores bool and boolean as tinyint Workbench is not able to guess if original wanted data type was tinyint or bool or boolean.

I will set this bug here as duplicate of bug #8485 because that is the server bug report for getting a real boolean data type.
[26 Feb 2010 9:22] Kai Sautter
Thank you for pointing me to this parallelism, which I am not going to argue.

Nevertheless, it would be helpful, if WB would then reverse engineer BOOL and BOOLEAN field types to TINYINT(1), as the server currently does (but including a comment, that the script indicated a BOOL or BOOLEAN column):

mysql> create table testbool (fieldbool BOOL, fieldboolean BOOLEAN);
Query OK, 0 rows affected (0.19 sec)

mysql> show create table testbool;
+----------+-----------------------------------------------------------------+
| Table    | Create Table                                                    |
+----------+-----------------------------------------------------------------+
| testbool | CREATE TABLE `testbool` (
  `fieldbool` tinyint(1) default NULL,
  `fieldboolean` tinyint(1) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+----------+-----------------------------------------------------------------+
1 row in set (0.00 sec)

This would simplify reverse engineering of manually written scripts, as the server will accept BOOLEAN treatment of TINYINT columns when actually using the database.