Chapter 29. Extending The MySQL Migration Toolkit

Table of Contents

29.1. Introduction
29.2. Architecture of the MySQL Migration Toolkit
29.3. The Modular Migration Process
29.4. Tools Required to Extend the MySQL Migration Toolkit

29.1. Introduction

One of the key features of the MySQL Migration Toolkit is that it can be easily extended and customized to support new data sources. This is done through the use of its Generic RunTime (GRT) Environment.

Extending the MySQL Migration Toolkit to support a new RDBMS requires the creation of two new modules: one module that reverse engineers (ie., retrieves schema information) the source database objects and converts them into GRT objects, and one module that migrates the source GRT objects into MySQL GRT objects. The MySQL Migration Toolkit then converts the GRT MySQL objects into SQL statements that create the target MySQL server objects.

Existing modules can be easily expanded and customized to achieve the perfect migration for individual requirements. New migration “methods” that define how the migration is performed can be added easily. The new methods are listed and can be selected from the Wizard interface or used in migration scripts.

29.2. Architecture of the MySQL Migration Toolkit

The MySQL Migration Toolkit is built on three primary modules: reverse engineer modules, migration modules, and transformation modules.

Reverse engineering modules retrieve the schema information from the source database and return GRT objects that describe the schema. Reverse engineering modules will have a name similar to ReverseEngineeringAccess.

Migration modules convert the source database GRT objects to MySQL GRT objects and then handle the bulk data transfer between the source and MySQL databases. Migration modules will have a name similar to MigrationAccess.

Transformation modules convert the MySQL GRT objects into the actual SQL statements used to create objects such as tables and views on the target MySQL server. Transformation modules will have a name similar to TransformationMySQL. Transformation modules are supplied by the MySQL GUI team and need not be created to add support for a new source database.

All modules are derived from base classes whose methods can be rewritten to match the new source database.

29.3. The Modular Migration Process

From the point of view of modular development, the migration process is as follows:

  1. The MySQL Migration Toolkit prompts the user for a source database and connection parameters. The user selection determines which modules will be used for the source database.

  2. The MySQL Migration Toolkit calls the testConnection method of the reverse engineering module. The testConnection method returns success or failure to the MySQL Migration Toolkit.

  3. The MySQL Migration Toolkit calls the getSchemata method of the reverse engineering module. The getSchemata method returns a list of the schemata available on the source RDBMS.

  4. Once the user has selected one or more schemata to migrate, the MySQL Migration Toolkit calls the reverseEngineer method of the reverse engineering module. The reverseEngineer method converts all objects in the source RDBMS (tables, views, procedures) into a collection of GRT objects.

  5. After the source database has been reverse engineered, the MySQL Migration Toolkit calls the migrationMethods method of the migration module. The migrationMethods method generates a list of available methods than can be selected by the user in the Object Mapping Screen.

  6. Once the user has selected the migration methods, the MySQL Migration Toolkit calls the migrate method of the migration module. The migrate method converts the source RDBMS GRT objects into MySQL GRT objects by calling the selected migration method for each source schema object. If no explicit method is assigned, the default migration method for the object type will be used.

  7. After the MySQL GRT objects have been created, the MySQL Migration Toolkit calls the transformation module to convert the MySQL GRT objects into SQL statements that will create the objects on the target MySQL server. The MySQL Migration Toolkit then either executes the SQL statements on the target MySQL server or writes them to a script file.

  8. In the final step, the MySQL Migration Toolkit calls the dataBulkTransfer method of the migration module. The dataBulkTransfer method loops through the selected tables in the selected schema and migrates the rows of the tables to the target MySQL database or loads them into a script file, depending on the user preference.

29.4. Tools Required to Extend the MySQL Migration Toolkit

The MySQL AB GUI Team uses Eclipse for development of the MySQL Migration Toolkit modules and recommends Eclipse for use when developing modules for the MySQL Migration Toolkit. See http://www.eclipse.org/ for more information.