Bug #69544 Forward Engineer / Synchronize Model: can't toggle database name
Submitted: 21 Jun 2013 19:41 Modified: 22 Jun 2013 2:13
Reporter: Rasmus Schultz Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:6.0.2 beta OS:Windows (8)
Assigned to: CPU Architecture:Any

[21 Jun 2013 19:41] Rasmus Schultz
Description:
All generated SQL statements during Forward Engineer and Synchronize Model operations come fully qualified, with database names, e.g.:

CREATE TABLE IF NOT EXISTS `database_name`.`project` ...

MWB also consistently generates USE `database_name` statements during Forward Engineer operations, which means you can't repeat the migration on a different system, or against a different version of the database.

It appears there is no way to toggle this on/off?

In practice, that doesn't work, because databases often have a different name on your local development system, compared to your staging or production servers. It's also common to have staging and production versions of the same database on the same system, which currently can only be accounted for by manually editing the generated SQL statements prior to running them.

It would be strongly preferable to have migration files that you can run anywhere, assuming you have already issued a USE statement, regardless of the database name on the system you're upgrading.

How to repeat:
See above

Suggested fix:
Add a switch to toggle fully qualified SQL statements.
[21 Jun 2013 22:09] MySQL Verification Team
Thank you for the bug report. Forward Engineer->Set Options for Database to be created have you checked the option Omit Schema Qualifier in Object Names?. Thanks.
[21 Jun 2013 23:01] Rasmus Schultz
The setting is available in the Forward Engineer wizard as you described, but there are no equivalent settings in the Synchronize Model wizard?

It seems the settings in this page of the Forward Engineer wizard are actually persisted with the project - but only if you actually complete the wizard.

It seems rather odd, that persisted project settings are otherwise hidden from the interface, and only visible during one step of a wizard?

It would make more sense for these settings to be available in a dialog somewhere, so that you can adjust the setting and save them, without actually completing the wizard.

And most likely, most of these settings really ought to apply to both the Forward Engineer and Synchronize Model wizards.

Or not?
[22 Jun 2013 2:13] Alfredo Kojima
This seems to be a duplicate of bug #55954