Bug #61140 Add a function to generate a migration to/from schemas/scripts
Submitted: 12 May 2011 1:15 Modified: 12 May 2011 3:13
Reporter: Chris Nanney Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any
Tags: migrations

[12 May 2011 1:15] Chris Nanney
Description:
To use migrations in many app frameworks requires an UP and a DOWN function to easily make/undo changes to the database.

If I make changes to a schema, I can now "Forward engineer SQL ALTER script" based off a previously exported version of the schema to effectively get the UP command. Simple example:

ALTER TABLE 'table' ADD COLUMN 'column' VARCHAR(100) NULL DEFAULT NULL;

It would be nice to also automatically generate a DOWN script to undo any changes made:

ALTER TABLE 'table' DROP COLUMN 'column';

I know this is a very simple example, but when making anything more than a trivial change to a schema, it is a tedious affair to manually create the corresponding DOWN script every time. I suggest adding a "Create Migration Scripts" to the export menu that takes a reference create script, and creates UP and DOWN migrations to either the currently open schema or another script.

Looking forward, it would be nice to include versioning functionality in Workbench itself, where as opposed to just saving any changes to an open schema, you can save a new version, and the .mwb file contains a history of all saved versions of the schema. You can then easily restore the schema to any previously saved state, or create migrations to/from any version.

How to repeat:
N/A
[12 May 2011 3:13] Valeriy Kravchuk
Thank you for the feature request.