Bug #36178 Forward engineer SQL ALTER script doesn't handle database names correctly.
Submitted: 17 Apr 2008 12:54 Modified: 14 Oct 2008 10:04
Reporter: Simon Epskamp Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:5.0.19 OS:Windows (XP)
Assigned to: Vladimir Kolesnikov CPU Architecture:Any
Tags: Database name, forward engineer, sql alter

[17 Apr 2008 12:54] Simon Epskamp
Description:
I've got the same database on different servers, with different names. Lets call them db1 and db2.

After importing db1 of them via 'reverse engineer mysql script' and making some changes, the 'forward engineer SQL ALTER script' option does work correctly when using the exported db1 script as a basis, but doesn't when using the db2 script as a basis. In this case tables with the same name aren't recognized as being 'the same' so the alter script contains generation code for all the tables.

I have done some experimenting and noticed that this is caused by the different database names. If I take the db2 exported script, and simply change the database name to db1 everywhere, the 'forward engineer SQL ALTER script' option works as expected.
However: simply changing the name of the database inside the workbench to db2, DOES NOT work. Apparently the original imported name is remembered somewhere.

(please note that if the databases were exactly the same this wouldn't be a problem, I could use the same script for both db's. But in my case there are some sleigth differences already)

How to repeat:
* Create the same database twice, with a different name.
* Export these databases to scripts.
* Import the first script into workbench.
* Observe that the 'forward engineer SQL ALTER script' option does work correct using the first script as the input file, but doesn't when using the second script.

* Additionally: observe that the backward button in the 'forward engineer SQL ALTER script' doesn't function correctly, a changed input file isn't taken into account.
[18 Apr 2008 14:30] Johannes Taxacher
testfile db1

Attachment: mydb.sql (application/octet-stream, text), 402 bytes.

[18 Apr 2008 14:30] Johannes Taxacher
testfile db2

Attachment: mydb2.sql (application/octet-stream, text), 369 bytes.

[21 Aug 2008 18:42] Johannes Taxacher
WB handles this case now correctly. fix is incorporated in 5.0.24
[14 Oct 2008 10:04] Tony Bedford
An entry was added to the 5.0.24 changelog:

If a database was imported using Reverse Engineer SQL ALTER Script and the database name changed in Workbench, the script then generated by Forward Engineer SQL ALTER Script was incorrect.