Workbench 8.0.19 on Windows 10
MySql Server 8.0.19 on Windows 10 / Ubuntu
The synchronize model function acts strange.
I created a very simple model and synchronized it with the target database which created the schema fine.
If I immediately synchronize the model again, the database is suddenly out of sync and it is suggested to drop all existing foreign keys and add them again. If I synchronize again the same is happening and again and again...
Why is this happening?
=== Here is the code generated after at the first synchronize model to create the schema in the database:
CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci ;
CREATE TABLE IF NOT EXISTS `mydb`.`cars` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`something` VARCHAR(45) NULL DEFAULT NULL,
`company_id` INT(11) NOT NULL,
PRIMARY KEY (`id`),
INDEX `fk_cars_company_idx` (`company_id` ASC) VISIBLE,
CONSTRAINT `fk_cars_company`
FOREIGN KEY (`company_id`)
REFERENCES `mydb`.`company` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;
CREATE TABLE IF NOT EXISTS `mydb`.`company` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`somethingelse` VARCHAR(45) NULL DEFAULT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;
=== Here is the code generated immediately after the first synchronize:
ALTER TABLE `mydb`.`cars`
DROP FOREIGN KEY `fk_cars_company`;
ALTER TABLE `mydb`.`cars`
ADD CONSTRAINT `fk_cars_company`
FOREIGN KEY (`company_id`)
REFERENCES `mydb`.`company` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION;
MySql Server 8.0.19 on Windows 10 / Ubuntu
The synchronize model function acts strange.
I created a very simple model and synchronized it with the target database which created the schema fine.
If I immediately synchronize the model again, the database is suddenly out of sync and it is suggested to drop all existing foreign keys and add them again. If I synchronize again the same is happening and again and again...
Why is this happening?
=== Here is the code generated after at the first synchronize model to create the schema in the database:
CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci ;
CREATE TABLE IF NOT EXISTS `mydb`.`cars` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`something` VARCHAR(45) NULL DEFAULT NULL,
`company_id` INT(11) NOT NULL,
PRIMARY KEY (`id`),
INDEX `fk_cars_company_idx` (`company_id` ASC) VISIBLE,
CONSTRAINT `fk_cars_company`
FOREIGN KEY (`company_id`)
REFERENCES `mydb`.`company` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;
CREATE TABLE IF NOT EXISTS `mydb`.`company` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`somethingelse` VARCHAR(45) NULL DEFAULT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;
=== Here is the code generated immediately after the first synchronize:
ALTER TABLE `mydb`.`cars`
DROP FOREIGN KEY `fk_cars_company`;
ALTER TABLE `mydb`.`cars`
ADD CONSTRAINT `fk_cars_company`
FOREIGN KEY (`company_id`)
REFERENCES `mydb`.`company` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION;