Database Shifter User Guide

XStudio fat client comes with a tool called XDatabaseShifter.
  • On Windows platforms, you can find it in the xstudio folder. The executable is named xdatabaseshifter_console.exe
  • On MacOSX and linux platforms, the executable script is named xdatabaseshifter.sh

Goal

XDatabaseShifter is aimed at making the merge of XStudio databases easier.
If you have several databases hosting data of different XStudio instances this can be very useful to merge data from one instance to another one.
WARNING: First, make sure to backup all your data (make a dump of all the databases involved, and check the dump)

Process

Let's take the assumption that you have 2 databases A and B.
The following process should allow you to merge all the main data (including all versions, embedded images etc.) from B to A.
  • Use SQLYog community version (or the pro version if you have a license) to backup B
    For this use the following settings:


    sqlyog backup options


    it will generate a .sql file (i.e. "dump_A.sql")


  • Execute xdatabaseshifter_console.exe providing:
    • "dump_B.sql"'s path as input
    • "dump_B_shifted.sql"'s path as output (it will be created if it does not exist yet)
    • An integer decay value that will be added to all ids in B

    This is filtering the original dump to keep only the INSERT clauses (if they are non-null) (CREATE or DROP clauses are filtered out ).
    All the non-default ids are also shifted using the decay value.
    Content of the INSERT data are also checked and modified accordingly if they include embedded images so that they reference the new shifted ids.


  • Use SQLYog community version (or the pro version if you have a license) to import "dump_B_shifted.sql" in A



Usage

To make an existing SQL dump to be ready to be merged in another XStudio database, you will just have to call the XDatabaseShifter executable with the appropriate arguments which are...
Usage: xdatabaseshifter_console.exe --inputFilePath <input SQL Dump file path>
                                    --outputFilePath <output SQL Dump file path>
                                    --decay <decay>

Example

xdatabaseshifter_console.exe --inputFilePath "C:/dump_B.sql" --outputFilePath "C:/B_shifted.sql"
--decay 100000