Bug #56938 model synchronise will delete unticked database
Submitted: 22 Sep 2010 15:17 Modified: 6 Oct 2010 10:38
Reporter: ken sands Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S2 (Serious)
Version:5.2.28 OS:Windows
Assigned to: Alexander Musienko CPU Architecture:Any
Tags: synchronize

[22 Sep 2010 15:17] ken sands
Description:
Unticked schemata gets dropped by N/A -> dbname when synchronizing.

I have 2 databases, and 2 models, where there is a link between the databases I've added a single table from DB2 into the model of DB1 in order to create and show it's one to one FK.

I do not maintain DB2 so when making changes in Model1 I always untick DB2 from the schemata to be processed, however since adding this table doing this causes the addition of N/A -> DB2 to the synchronize screen. if I allow this to go ahead the result is the total wipeout of DB2!

Fortunately we had a full backup from only a few hours before. 

How to repeat:
Create 2 DBs and 2 (maybe only 1 needed) models (one for each)

From the catalog tree drag a table from DB2 onto the model for DB1.

Make a change in db1 and go to model->synchronize

Untick DB2 in the schemata to be processed screen

Follow the rest of the steps without change.

(note DROP SCHEMA IF EXISTS `DB2` ; has appeared in the SQL!)

DB2 is now gone.

Suggested fix:
If a schemata is unticked there should be no way of it being affected by the synchronise. I'm unsure why the N/A -> DB2 appears in this situation. but shocked that it's come up with a drop schema!

Ensure unticked schemas can not be affected at all.
[22 Sep 2010 15:18] ken sands
Forgot to mention, if both schemata are left ticked everything works ok, no changes happen to DB2 (assuming nothing on the model for db2 has changed) and nothing evil happens, evil stuff happened because I was trying to be safe!
[5 Oct 2010 13:49] Johannes Taxacher
fix confirmed in repository
[6 Oct 2010 10:38] Tony Bedford
An entry has been added to the 5.2.29 changelog:

When synchronizing a model to a live database, if a database was deselected in the wizard, to prevent it from being part of the synchronization process, a DROP statement for that database was generated in the SQL code, causing that database to be dropped from the live database, with corresponding loss of all data.