Bug #59934 Synchronize model fails to synchronize changes to some triggers
Submitted: 4 Feb 2011 4:56 Modified: 12 Mar 2014 3:55
Reporter: Nicholas Sherlock Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S2 (Serious)
Version:5.2.31a OS:Windows
Assigned to: CPU Architecture:Any

[4 Feb 2011 4:56] Nicholas Sherlock
Description:
"Synchronize model" only notices changes to some triggers, ignoring changes to others. It is not capable of updating these triggers even if forced by using the "update source" button.

How to repeat:
1. Create a new model.
2. Double click "add table" to create a new table.
3. At the bottom of the page, visit the "columns" tab. This will cause a primary key to be generated for the table.
4. Go to the Triggers tab. Enter:

DELIMITER $$

USE `mydb`$$

CREATE TRIGGER test_before_insert BEFORE INSERT ON table1 FOR EACH ROW BEGIN
    DECLARE i INT DEFAULT 1;
END $$

CREATE TRIGGER test_after_insert AFTER INSERT ON table1 FOR EACH ROW BEGIN
    DECLARE i INT DEFAULT 1;
END $$

CREATE TRIGGER test_before_update BEFORE UPDATE ON table1 FOR EACH ROW BEGIN
    DECLARE i INT DEFAULT 1;
END $$

CREATE TRIGGER test_after_update AFTER UPDATE ON table1 FOR EACH ROW BEGIN
    DECLARE i INT DEFAULT 1;
END $$

CREATE TRIGGER test_before_delete BEFORE DELETE ON table1 FOR EACH ROW BEGIN
    DECLARE i INT DEFAULT 1;
END $$

CREATE TRIGGER test_after_delete AFTER DELETE ON table1 FOR EACH ROW BEGIN
    DECLARE i INT DEFAULT 1;
END $$

4. Go to Database -> Synchronize Model, and synchronize with your favourite connection. The table and triggers are successfully created (you can confirm with USE mydb; SHOW TRIGGERS).

5. On the Triggers tab, change all of the "DEFAULT 1" statements to "DEFAULT 2".

6. Synchronize the model again. On my machine the "differences" section only shows changes to the AFTER INSERT, AFTER UPDATE and BEFORE DELETE triggers. It did not notice changes to BEFORE INSERT, BEFORE UPDATE, or AFTER DELETE. Select those triggers that got missed out and click "update source" to ask for those to be updated too.

7. The generated SQL completely ignores those updated triggers that didn't appear as being updated in the "select changes to apply" step.
[4 Feb 2011 7:37] Valeriy Kravchuk
Thank you for the bug report. Verified on Windows XP SP3 while trying to synchronize with local MySQL server 5.1.54.
[30 Mar 2011 9:10] R B
I can verify this. It also doesn't synchronize changed views. I always end up removing the view before synchronizing
[12 Mar 2014 3:55] Philip Olson
Fixed as of the upcoming MySQL Workbench 6.1.3 release, and here's the changelog entry:

The "Synchronize Model" routine would only notice changes to some
triggers, while ignoring changes to others. It would not update these
triggers even if forced by using the "Update Source" button.

Thank you for the bug report.