Database Refactoring Tool - Rename Fearlessly

Improve design of your database schema using database refactoring tool. This feature available in dbForge Studio for MySQL is perfect for applying small changes to your database that can result in broadening or reduction of the available functionality, adding new data or changing the meaning of the existing data.

Renaming columns referenced by other columns using foreign keys

When renaming a column, you always need to worry about references that use foreign keys - if you rename a column using the ordinary way, these connections will be lost or you will have to find all foreign keys, delete them, rename the column and recreate the keys. Database refactoring tool for MySQL saves you the trouble. The application will find all foreign keys and will apply the new column name in all database.

Database Refactoring: Renaming a Column

Renaming columns used in creating views

It often happens that the column you need to rename is used in views. In case you just rename the column, you'll get an error when data is selected for the view. To avoid it, you will have to edit all views that use the renamed column after you actually rename it. But that was before dbForge Studio for MySQL got the database refactoring tool. Now it will edit all views on its own and they will be working after you just rename the column.

Database Refactoring: Renaming a Column used in a View

Renaming objects with code

To rename an object that contains code, for example, a stored routine, you need to be twice as careful as you were in the first two situations. If you rename your stored routine and make a mistake in the code, the procedure or function will be lost and you will have to recreate it from memory.

dbForge Studio for MySQL refactoring tool uses an algorithm, that is different from the one available in all MySQL administration tools:

  1. A temporary stored routine is created. It contains the code of the procedure before renaming.
  2. All objects that use this routine are deleted.
  3. All objects that use this stored routine are recreated, but the routine is renamed.
  4. The routine with new name and new code is created.
  5. The temporary stored routine is deleted.

In case the fifth step fails, the script execution stops and the original code can be restored from the temporary object.

Database Refactoring: Renaming Objects with Code