Description:
When I try to synchronize my model Workbench, sometimes generates code like that:
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
CREATE TABLE IF NOT EXISTS `model_customer`.`bs_task` (
`task_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
`project_id` INT(10) UNSIGNED NULL DEFAULT NULL ,
`project_task_group_id` INT(10) UNSIGNED NULL DEFAULT NULL ,
`salt` VARCHAR(64) NULL DEFAULT NULL ,
`code` VARCHAR(64) NULL DEFAULT NULL ,
`is_done_flag` TINYINT(4) NOT NULL DEFAULT 0 ,
`due_date` DATETIME NULL DEFAULT NULL ,
`assigned_to_user_id` INT(10) UNSIGNED NULL DEFAULT NULL ,
`sequence` INT(10) UNSIGNED NOT NULL DEFAULT 0 ,
`priority` VARCHAR(64) NULL DEFAULT NULL ,
`short_description` VARCHAR(1024) NULL DEFAULT NULL ,
`description` VARCHAR(1024) NULL DEFAULT NULL ,
`created_by` INT(11) NOT NULL ,
`creation_date` DATETIME NOT NULL ,
`modified_by` INT(11) NOT NULL ,
`modification_date` DATETIME NOT NULL ,
PRIMARY KEY (`task_id`) ,
INDEX `fk_bs_task_bs_user1_idx` (`assigned_to_user_id` ASC) ,
INDEX `fk_bs_task_pr_project1_idx` (`project_id` ASC) ,
INDEX `fk_bs_task_pr_project_task_group1_idx` (`project_task_group_id` ASC) ,
CONSTRAINT `fk_bs_task_bs_user1`
FOREIGN KEY (`assigned_to_user_id` )
REFERENCES `model_customer`.`bs_user` (`user_id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_bs_task_pr_project1`
FOREIGN KEY (`project_id` )
REFERENCES `model_customer`.`pr_project` (`project_id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_bs_task_pr_project_task_group1`
FOREIGN KEY (`project_task_group_id` )
REFERENCES `model_customer`.`pr_project_task_group` (`project_task_group_id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
CREATE TABLE IF NOT EXISTS `model_customer`.`bs_task_message` (
`task_message_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
`message` VARCHAR(1024) NULL DEFAULT NULL ,
`message_type` VARCHAR(64) NOT NULL COMMENT 'comment, image, other' ,
`created_by` INT(10) UNSIGNED NOT NULL ,
`creation_date` DATETIME NOT NULL ,
`modified_by` INT(10) UNSIGNED NOT NULL ,
`modification_date` DATETIME NOT NULL ,
`task_id` INT(10) UNSIGNED NOT NULL ,
PRIMARY KEY (`task_message_id`) ,
INDEX `fk_bs_task_message_bs_task1_idx` (`task_id` ASC) ,
CONSTRAINT `fk_bs_task_message_bs_task1`
FOREIGN KEY (`task_id` )
REFERENCES `model_customer`.`bs_task` (`task_id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
CREATE TABLE IF NOT EXISTS `model_customer`.`bs_file` (
`file_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
`salt` VARCHAR(64) NULL DEFAULT NULL ,
`code` VARCHAR(64) NULL DEFAULT NULL ,
`protokol` VARCHAR(64) NOT NULL DEFAULT 'http' ,
`server_url` VARCHAR(64) NOT NULL ,
`path` VARCHAR(512) NOT NULL COMMENT 'customer/project path' ,
`name` VARCHAR(256) NOT NULL COMMENT 'original file name' ,
`extension` VARCHAR(64) NOT NULL COMMENT 'jpg, png ...' ,
`file_size` INT(11) NOT NULL ,
`created_by` INT(10) UNSIGNED NOT NULL ,
`creation_date` DATETIME NOT NULL ,
`modified_by` INT(10) UNSIGNED NOT NULL ,
`modification_date` DATETIME NOT NULL ,
PRIMARY KEY (`file_id`) )
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
CREATE TABLE IF NOT EXISTS `model_customer`.`bs_task_message_file` (
`task_message_file_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
`task_message_id` INT(10) UNSIGNED NOT NULL ,
`file_id` INT(10) UNSIGNED NOT NULL ,
`created_by` INT(10) UNSIGNED NOT NULL ,
`creation_date` DATETIME NOT NULL ,
`modified_by` INT(10) UNSIGNED NOT NULL ,
`modification_date` DATETIME NOT NULL ,
PRIMARY KEY (`task_message_file_id`) ,
INDEX `fk_bs_task_message_file_bs_task_message1_idx` (`task_message_id` ASC) ,
INDEX `fk_bs_task_message_file_bs_file1_idx` (`file_id` ASC) ,
CONSTRAINT `fk_bs_task_message_file_bs_task_message1`
FOREIGN KEY (`task_message_id` )
REFERENCES `model_customer`.`bs_task_message` (`task_message_id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_bs_task_message_file_bs_file1`
FOREIGN KEY (`file_id` )
REFERENCES `model_customer`.`bs_file` (`file_id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
CREATE TABLE IF NOT EXISTS `model_customer`.`bs_observed_task` (
`observed_task_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
`user_id` INT(10) UNSIGNED NOT NULL ,
`task_id` INT(10) UNSIGNED NOT NULL ,
`is_new_comment_flag` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0 ,
`is_observed_flag` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0 ,
`created_by` INT(10) UNSIGNED NOT NULL ,
`creation_date` DATETIME NOT NULL ,
`modified_by` INT(10) UNSIGNED NOT NULL ,
`modification_date` DATETIME NOT NULL ,
PRIMARY KEY (`observed_task_id`) ,
INDEX `fk_bs_observed_task_bs_user1_idx` (`user_id` ASC) ,
INDEX `fk_bs_observed_task_bs_task1_idx` (`task_id` ASC) ,
CONSTRAINT `fk_bs_observed_task_bs_user1`
FOREIGN KEY (`user_id` )
REFERENCES `model_customer`.`bs_user` (`user_id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_bs_observed_task_bs_task1`
FOREIGN KEY (`task_id` )
REFERENCES `model_customer`.`bs_task` (`task_id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
DROP TABLE IF EXISTS `model_customer`.`bs_task_message_file` ;
DROP TABLE IF EXISTS `model_customer`.`bs_task_message` ;
DROP TABLE IF EXISTS `model_customer`.`bs_task` ;
DROP TABLE IF EXISTS `model_customer`.`bs_observed_task` ;
DROP TABLE IF EXISTS `model_customer`.`bs_file` ;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
I already have all the mentioned tables (and some others). Why Workbench suggest me to remove existing tables???
The thing is that it happens each time I switch into another model, synchronize it and than come back to the first model.
----- Developer Notes -----
MySQL Workbench CE for Mac OS X version 5.2.44 revision 9933
Configuration Directory: /Users/wmocarski/Library/Application Support/MySQL/Workbench
Data Directory: /Applications/MySQLWorkbench.app/Contents/Resources
Cairo Version: 1.9.1
OS: Darwin 12.2.0
CPU: 4x Intel(R) Core(TM) i7-2677M CPU @ 1.80GHz, 4.0 GB RAM
How to repeat:
1. I run Synchronize model_customer -> no changes
2. I switch into another model_other
3. I run Synchronize model_other -> no changes
4. I switch again to model_customer
5. I run Synchronize model_customer -> many (as above) changes !!!!! I rejected synchronization.
6. I re-choose again model_customer (having it still opened)
7. I run Synchronize model_customer -> no changes !!!!
I don't understand it, but it works like that.
It's pity to say but at the moment Workbench should go back to beta stage and should not be recomended in production environment. Current version works much better than previous one, which had all the time index naming problem, but it's still unstable.