uniPaaS (now called Magic xpa Application Platform) from Magic Software Enterprises is a powerful application platform that simplifies the process of building and deploying business applications. Although this platform has been available for many years and supports SQL databases, Btrieve tends to be the database of choice for Magic developers.
Let's take a closer look at Mertech's MigrateUniPaasData migration tool, which can be used to convert a multi-company, Magic uniPaaS application to an SQL backend.
MigrateUniPaasData converts an application running on Btrieve data files to an SQL server backend without compromising the stability or speed of the application and without requiring any source code changes. MigrateUniPaasData does this by reading the application source files (datasources.xml, datasourcesindex.xml, magic.ini and models.xml) to create the SQL database and then storing the SQL table schema in INT files that the Mertech BTR2SQL drivers use to connect to and open the converted SQL tables.
An overview of the Magic migration process
To perform a migration, you prepare your files and then run MigrateUniPaasData from the command line. MigrateUniPaasData accepts the following arguments:
MigrateUniPaasData [Operation] [Configuration Parameters] Source
- [Operation]: Determines the type of migration performed. You can perform a full migration, create a SQL script a DBA can run to perform the migration themselves, or perform a partial migration that only creates tables or copies data.
- [Configuration Parameters]: Provides settings used during the migration. These include:
- The location of the Mertech dll.
- The server to migrate data to.
- The database and schema name of your SQL server.
- Server login information.
- Trace settings.
- Source: Provides the name of the directory containing your application’s source files. For example, you could run MigrateUniPaasData using the following settings:
MigrateUniPaasData Full -dll sql_btr.dll -datalocation c:\myapp\data -magicini c:\myapp\magic.ini -server mssql\2008 -database MyAppDB -schema c001
Note: For a full walkthrough of using MigrateUniPaasData, refer to the Migrating Magic uniPaaS Applications section of the BTR2SQL User’s Guide.
When you run MigrateUniPaasData, it migrates your application from Btrieve to SQL by:
1. Creating SQL tables: MigrateUniPaasData reads your application’s source files and creates corresponding tables on the SQL server.
2. Creating .INT files: MigrateUniPaasData creates one .INT file for each converted data file. The .INT files map your existing files to their SQL equivalents.
3. Copying data to the SQL server: MigrateUniPaasData copies data from your existing files to the newly-created SQL tables.
As you can see, migrating a one directory application is relatively simple. However, uniPaaS applications typically store information using multi-directory layouts, making the migration process a bit more complex.
Preparing for multi-directory migrations
Our customers commonly store data using multi-directory layouts, in which general information is stored in a global corporate directory, and customer-specific information is stored in a variety of separate directories. These customer-specific directories often include files with duplicate names, as shown below:
Creating Multi-directory Migration Files To prepare each of your application’s directories for migration, you can specify configuration settings for the MigrateUniPaasData tool:
- Using the command line arguments detailed above.
- In mds.ini files you create within your application.
- In MigrateUniPaasData.ini files you create within your application.
Note that settings entered on the command line override settings you specify in .ini files. For our example, we’ve created both an mds.ini and MigrateUniPaasData.ini file for each of our application’s directories, because creating these .ini files allows BTR2SQL to access configuration settings post-migration.
The diagram below shows our starting layout (on the left) and our pre-migration layout (on the right):
You’ll notice we’ve created not only a series of .ini files (outlined in green above) for each directory, but also a series of batch files (outlined in blue) that will perform and validate the migration.
Next in the process, you need to create batch files and .ini files, to control how your application’s tables are created and accessed on SQL.
To get the step-by-step procedures, along with the steps for performing your multi-directory migration, a how-to guide for adding and deleting tables and directories, and important pre-migration considerations, get your free copy of the white paper, Multi-company migration of a Magic application using the BTR2SQL MigrateUniPaasData Tool.
NOTE: MigrateUniPassData relies on an application's XML source code to create the SQL database. If your database structure is stored in DDFs, refer to the BTR2SQL white paper: Multi-company Migration of a Btrieve Application Using the BTR2SQL GUI.
Originally published Jun 17, 2015, updated Oct 23, 2018