Transformo is a framework used as the basis for David Romero's Ph.D. thesis. Transformo is a framework with which you can perform migrations between relational databases using software product lines, obtaining custom SQL scripts compatible with each other.
git clone https://github.com/diverso-lab/transformo
cd transformo
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
All valid products of the transformation feature model can be generated by executing:
python test_application_engineering.py
These scripts are stored in the folder workspaces/DW2/scripts
.
In this section we detail how to generate a Drupal instance with sample data as source system and an empty WordPress instance as target system to validate the migration functionality of the Transformo framework.
We move to dp-to-wp
cd dp-to-wp
Now, we must deploy our Drupal and WordPress instances with Docker (one step at a time, in the order shown). First, we deploy our Drupal services:
make prepare_drupal
make install_drupal
The following commands will start our WordPress instances:
make prepare_wordpress
make install_wordpress
Thus, we have started a Drupal container populated with test data on port :8080 and a PHPMyAdmin instance on :8081, which will represent our source system. We have also started a configured and empty WordPress instance to represent our target, on port :8083 and its PHPMyAdmin on port :8084.
Web | MySQL | PHPMyAdmin | Credentials (Web /admin & PHPMyAdmin database access) | |
---|---|---|---|---|
Drupal | :8080 | :33061 | :8081 | user=drupal, password=drupal |
WordPress | :8082 | :33062 | :8083 | user=wordpress, password=wordpress |
If you have already installed both Drupal and Wordpress, you can execute the following commands to up or down the corresponding containers:
make up
make down
To test the scripts, we must have both Drupal and WordPress up.
Since a SQL script only allows movements between databases within the same server, we are forced (at least for the moment) to download the Drupal database and import it into the WordPress MySQL container.
First, we access the Drupal phpMyAdmin in localhost:8081
, with the credentials drupal:drupal
. We go to Export and choose the Quick option.
Once done, we now go to the Drupal phpMyAdmin in localhost:8083
with the credentials root:woordpress
. We create a database called drupal
, hit Import
and import our drupal.sql
.
We are ready!
We have prepared a script that disables NULL and AUTOINCREMENT constraints. Since our validation focuses on dumping field by field from one database to another, it is important that the target database has no restrictions on individually updated fields.
Therefore, in the SQL tab, we execute the code contained in workspaces/DW2/scripts/prepare.sql
:
We can run any of the scripts located in the folder workspaces/DW2/scripts
. Remember that the execution of each script alters the original WordPress data, so it is necessary to run prepare.sql
again BEFORE each script. Otherwise, it will not work because MySQL will detect repeated keys.