Bug #59200 Forward Engineer for Trigger without Drop
Submitted: 28 Dec 2010 21:09 Modified: 16 Nov 2011 14:48
Reporter: Kujtim Shala Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:5.2.31 OS:Any (Windows 7 x64, Mac OS X)
Assigned to: CPU Architecture:Any
Tags: trigger

[28 Dec 2010 21:09] Kujtim Shala
Description:
The Forward Engineer for trigger in objects won't drop them before create even if the option is enabled.

How to repeat:
1. Create new EER model
2. Create new diagram
3. Place a new table
4. Add any trigger to the table
5. Use "Database" -> "Forward Engineer..."
6. Check the option "DROP Objects Before Each CREATE Object" to be activated
7. Perform the script for any database
8. Repat from 5. until the sql script view.

Now you can see, that the Trigger won't be dropped.

Suggested fix:
Include Trigger to the Objects that should be dropped before create.
[28 Dec 2010 23:48] MySQL Verification Team
Thank you for the bug report. I couldn't repeat or misunderstood what are you reporting:

USE `mydb`$$

DROP TRIGGER IF EXISTS `mydb`.`testref` $$

USE `mydb`$$

That what I see in the Review SQL Script step.
[29 Dec 2010 11:02] Kujtim Shala
I forgot to write:
1. select the option "DROP Objects Before Each CREATE Object"
2. select "Export MySQL Table Objects" and "Export MySQL Trigger Objects"

In this case the review of the sql script will show the "DROP TRIGGER" command. Now try following:
1. select the option "DROP Objects Before Each CREATE Object"
2. select just "Export MySQL Trigger Objects"

Now the triggers won't be dropped. Maybe you will be able now to reproduce this.
[30 Dec 2010 13:11] Valeriy Kravchuk
Verified as described in the last comment on Mac OS X.
[16 Nov 2011 14:48] Philip Olson
Fixed as of 5.2.37:

+        Within the <guimenu>Database</guimenu>, <guimenu>Forward
+        Engineer</guimenu> dialogue for a Model, the <literal>DROP
+        Objects Before Each CREATE Object</literal> option was ignored
+        if the <literal>Export MySQL Table Objects</literal> option was
+        not selected.
[23 Jan 2012 9:29] MANCUSO Julien
Hello,
I've installed the 5.2.37 version thinking that it would solve this problem but it's still here...

When you go to "File -> Export -> Forward Engineer SQL CREATE script" menu and generate a sql file selecting :
- "Generate DROP Statements Before Each CREATE Statement" (only) in the SQL export options
- "Export Mysql Trigger objects" and or without "Export Mysql Routine objects" in the SQL Object Export Filter 

The generating file doesn't contain the drop trigger statements

Thanks
[27 Mar 2012 12:29] Bartlomiej Wrega
This bug still occurs under version 5.2.38 for MS Windows, no-install package.

Way to reproduce it is as described by Kujtim Shala. Namely - leave only "Export MySQL Trigger Objects" option selected on second step of Forward Engineer dialog.

Please consider reopening this bug.