Skip to content

Data Migration from V1 to V2

As databases and data formats have changed in ASKCOSv2, user data saved in ASKCOSv1 can not be simply imported directly in V2. Every attempt was made to preserve the IPP and Tree Builder results, but there will be missing fields and/or result entries as some parts of the legacy formats are impossible to migrate. The scripts in the migration steps below have been tested on our internal server with ~1,000 saved user results, but feel free to contact us if you encounter problems with the scripts when migrating larger amounts of user data.

Data Migration Steps

Step 1. Export the data from V1

Get a copy of export_v1_data.sh on the server with the running ASKCOSv1 deployment. The script is designed to be runnable from any path. Change the 4 variables to the actual names (for the 2 containers) or the desired names (for the output paths of the 2 db dumps).

# Change these variables to the actual name
export V1_APP_CONTAINER_NAME=askcos_app_1
export V1_MONGO_CONTAINER_NAME=askcos_mongo_1
export MYSQL_DUMP_PATH_ON_HOST=/home/ztu/mysql_dump.json
export MONGO_DUMP_PATH_ON_HOST=/home/ztu/mongo_dump.json

Execute the script with

sh export_v1_data.sh

Once the script finishes execution, you will have the two db dump files at $MYSQL_DUMP_PATH_ON_HOST and $MONGO_DUMP_PATH_ON_HOST.

Step 2. Copy the db dump files from the V1 server to the V2 server

This can be done with scp or rsync if the machines are different, e.g.,

scp /home/ztu/mysql_dump.json ztu@v2-machine:/home/ztu/ASKCOSv2/mysql_dump.json
scp /home/ztu/mongo_dump.json ztu@v2-machine:/home/ztu/ASKCOSv2/mongo_dump.json

The destination paths on the V2 machine are flexible; we just need to configure the script to point to those files.

Step 3. Import the data into V2

Get a copy of import_v1_data_to_v2.sh on the server with the running ASKCOSv2 deployment. The script is designed to be runnable from any path. Change the 3 variables to the actual names.

# Change these variables to the actual name
export V2_APP_CONTAINER_NAME=deploy-app-1
export MYSQL_DUMP_PATH_ON_HOST=/home/ztu/ASKCOSv2/mysql_dump.json
export MONGO_DUMP_PATH_ON_HOST=/home/ztu/ASKCOSv2/mongo_dump.json

Execute the script with

sh import_v1_data_to_v2.sh

Once the script finishes execution, the legacy results are migrated into V2! The results are associated with the same usernames as V1, even if unregistered. Simply register with the same username as in V1, and the results should appear under the respective account (Profile>My Results).

Released under the MIT License.