mysqlmysql-workbenchmariadbsynchronizeforward-engineer

Synchronizing the model modifies UNSIGNED BIGINT to UNSIGNED BIGINT(19)


Environment:

When I try to synchronize the model with the database schema and I have en a table a defined type UNSIGNED BIGINT (that is UNSIGNED BIGINT(20)) then it becomes UNSIGNED BIGINT(19).

The same process with forward engineering works fine to these data types.

Model

model

Synchronizing model

Synchronizing model

CREATE TABLE IF NOT EXISTS `test`.`table` (
  `id` BIGINT(19) UNSIGNED NOT NULL,
  PRIMARY KEY (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;

Forward engineering

forward engineering

CREATE TABLE IF NOT EXISTS `test.`table1` (
`id` BIGINT UNSIGNED NOT NULL,
PRIMARY KEY(`id`))
ENGINE = InnoDB;

Could it be a bug in MySql Workbench?


Solution

  • The solution I found is to define de type like

    UNSIGNED BIGINT(20) --OK
    

    instead of

    UNSIGNED BIGINT  --KO
    

    MySql bug


    In practice it seems not to affect as we can see in the example Exemple

    create table test.biginttest (a BIGINT, b BIGINT(10), c BIGINT(15) ZEROFILL);
    
    INSERT INTO test.biginttest VALUES (-10,10,-10);
    
    INSERT INTO test.biginttest VALUES (9223372036854775808,9223372036854775808,9223372036854775808);
    
    select * from test.biginttest;
    

    Result

    enter image description here