Bug #55566 Copy and Paste of Table in EER Diagram fails to create a new table on sync
Submitted: 26 Jul 2010 17:23 Modified: 3 Sep 2010 15:35
Reporter: Rodrigo Capile Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:5.2.25 CE OS:Windows (XP)
Assigned to: Alexander Musienko CPU Architecture:Any
Tags: copy, EER Diagram, paste

[26 Jul 2010 17:23] Rodrigo Capile
Description:
When copy/paste a table on a EER Diagram, the synchroinize doesn´t idenitify it as a new table and overwrites the original one

How to repeat:
1) create a new model
2) create a table named `test` with a key named `id`
3) Forward engineer the model to the database
3) On the EER Diagram of the model copy and paste the table `test`. It will create a new table named `test_copy1`
4) rename the key of the new table to `id1` (just to differ from the original)
5) synchronize the model with the database

At the "Model and Database Differences" panel it will show
test       -> test
test_copy1 -> test

and it will create the following script:

CREATE  TABLE IF NOT EXISTS `test`.`test` (
  `id` INT(11) NOT NULL ,
  PRIMARY KEY (`id`) )
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1
COLLATE = latin1_swedish_ci;

ALTER TABLE `test`.`test` CHARACTER SET = latin1 , COLLATE = latin1_swedish_ci , CHANGE COLUMN `id` `id1` INT(11) NOT NULL  
, DROP PRIMARY KEY 
, ADD PRIMARY KEY (`id1`) , RENAME TO  `test`.`test_copy1` ;

if you copy the SQL to Clipbord and create the new table manually and try to synchronize the model with the database again at the "Model and Database Differences" panel it will show
test       -> test
test_copy1 -> test
N/A        -> test_copy1

The only workaround is to create the table_copy1 manually, delete it from the model and synchropnize the model/database to import it. Or create the `table_copy 1` from scratch
[26 Jul 2010 20:34] MySQL Verification Team
Thank you for the bug report.
[25 Aug 2010 17:16] Johannes Taxacher
fix confirmed in repository
[3 Sep 2010 15:35] Tony Bedford
An entry has been added to the 5.2.27 changelog:

If a table was copied in the EER Diagram view, and then the model synchronized with the live database, the synchronize functionality did not recognize the copied table as a new table, and overwrote the original table.