Bug #80685 Reverse Engineer doesn't parse NOT NULL constraint of generated column
Submitted: 10 Mar 2016 10:14 Modified: 10 Mar 2016 11:15
Reporter: tsubasa tanaka (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench: Migration Severity:S3 (Non-critical)
Version:6.3.6 OS:Microsoft Windows (7, 10)
Assigned to: CPU Architecture:Any

[10 Mar 2016 10:14] tsubasa tanaka
Description:
Reverse Engineer function in MySQL Workbench 6.3.6 doesn't import generated column with NOT NULL constraint correctly.

See "How to repeat".

How to repeat:
```
mysql> CREATE DATABASE d1;
mysql> CREATE TABLE d1.t1 (num int, gcol int AS (num + 1) NOT NULL);
mysql> SHOW CREATE TABLE d1.t1\G
*************************** 1. row ***************************
       Table: t1
Create Table: CREATE TABLE `t1` (
  `num` int(11) DEFAULT NULL,
  `gcol` int(11) GENERATED ALWAYS AS ((`num` + 1)) VIRTUAL NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
1 row in set (0.00 sec)
```

Launch MySQL Workbanch and click "File" => "New Model" => "Database" => "Reverse Engineer", and import d1 schema.

1. Right-click table object and select "Copy SQL to Clipboard".

```
CREATE TABLE IF NOT EXISTS `d1`.`t1` (
  `num` INT(11) NULL DEFAULT NULL,
  `gcol` INT(11) GENERATED ALWAYS AS ((`num` + 1)) VIRTUAL)
```

2. Double-click table object and see gcol's "NN" checkbox.
[10 Mar 2016 10:15] tsubasa tanaka
screen shot of bug#80685

Attachment: screenshot_80685.png (image/png, text), 63.10 KiB.

[10 Mar 2016 11:15] Umesh Shastry
Hello Tanaka-San,

Thank you for the report steps.
Verified as described with WB 6.3.6 on Win7.

Thanks,
Umesh