Bug #56614 Trigger problem after renaming schema
Submitted: 7 Sep 2010 12:07 Modified: 9 Jan 2015 10:24
Reporter: plamen vasilev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:5.2.27 OS:Any (tested in win, lin and os x)
Assigned to: CPU Architecture:Any
Tags: rename schema, trigger

[7 Sep 2010 12:07] plamen vasilev
Description:
When I reverse engenere a database and rename the schema's name the triggers are not renamed as they should.

The trigger is :
---------------------------------
DELIMITER $$
USE `test`$$
CREATE
DEFINER=`user`@`localhost`
TRIGGER `test`.`units_before_delete`
BEFORE DELETE ON `test`.`units`
FOR EACH ROW
BEGIN
	call do_something(OLD.id);
END$$
DELIMITER ;
---------------------------------
 
After renaming the schema 'test' to 'new_test' the trigger is :

---------------------------------
DELIMITER $$
USE `new_test`$$
CREATE
DEFINER=`user`@`localhost`
TRIGGER `test`.`units_before_delete`
BEFORE DELETE ON `test`.`units`
FOR EACH ROW
BEGIN
	call do_something(OLD.id);
END$$
DELIMITER ;
---------------------------------

How to repeat:
Create new schema.
Rename the schema 'mydb' to 'test'.
Reverce engenere the database test from server1.
Rename the schema to 'new_test'.
Synchronize model new_test with server2.
Before the synchronization the sql script for sync is wrong and the trigger is wrong :(
[7 Sep 2010 13:07] Johannes Taxacher
workbench doesn't yet feature refactoring sql-code objects (like views, triggers, etc.). this will be included in future versions
[7 Sep 2010 13:39] plamen vasilev
In the Linux version of workbench after renaming there is an icon (thunder) which fixes the views and the triggers.
The OS X version doesn't have this icon.