Pages

Wednesday, June 3, 2015

How to export/import your MorphX VCS settings and history

When using MorphX for version control, sometimes you need to restore a backup of a database, and you don't want to lose all of your check in/out history.  I wrote this job to export and import your MorphX VCS settings.

Use at your own risk, but it's worked fine for me.

Enjoy!


static void AKBackupMorphXVCData(Args _args)
{
    SysDataExport           sysDataExport;
    SysDataImport           sysDataImport;
    
    Dialog                  dialog = new Dialog();
    FormBuildRadioControl   fbImportExport;
    FormRadioControl        radioResults;
    
    dialog.addText("Warning, if you choose Import, this will replace your VCS data and is not reversible!");
    
    // Add the radio button, name it anything
    fbImportExport = dialog.formBuildDesign().addControl(FormControlType::RadioButton, 'RadioButton1');
    fbImportExport.caption("Choose Import/Export");
    fbImportExport.items(2); 

    fbImportExport.item(1);
    fbImportExport.text("Export");
    
    fbImportExport.item(2);
    fbImportExport.text("Import");

    dialog.doInit();
    dialog.formRun().design().moveControl(fbImportExport.id());
    dialog.run();

    if (dialog.closedOk())
    {
        radioResults = dialog.formRun().control(fbImportExport.id());
        
        if (radioResults.selection() == 0) // Export
        {
                sysDataExport = new SysDataExport();
                sysDataExport.parmDoNotBypassDefIO(true);
                sysDataExport.parmServerAccess(true);
                sysDataExport.addTmpExpImpTable(tableNum(SysVersionControlMorphXItemTable), false);
                sysDataExport.addTmpExpImpTable(tableNum(SysVersionControlMorphXLockTable), false);
                sysDataExport.addTmpExpImpTable(tableNum(SysVersionControlMorphXRevisionTable), false);
                sysDataExport.addTmpExpImpTable(tableNum(SysVersionControlParameters), false);
                sysDataExport.addTmpExpImpTable(tableNum(SysVersionControlSynchronizeLog), false);

                if (sysDataExport.prompt())
                {   
                    sysDataExport.parmFiletype(FileType::Binary);
                    sysDataExport.run();
                }
        }
        else if (radioResults.selection() == 1) // Import
        {
            sysDataImport = new SysDataImport();

            if (sysDataImport.prompt())
            {
                sysDataImport.parmLoadAll(true);
                sysDataImport.parmInclTablesNotPerComp(true);
                sysDataImport.parmFiletype(FileType::Binary);
                sysDataImport.run();

                versioncontrol.init();
            }
        }
        
        info("Done!");
    }
}

4 comments:

  1. Hi Alex

    I documented another way to do this on my blog post at http://www.k3technical.com/moving-morphx-version-control-data/. I didn't include the version control parameters table in my solution although there's no reason why you couldn't.

    Malcolm

    ReplyDelete
    Replies
    1. Ah, different way of accomplishing it. I'd have thought you'd have had issues with RecId's, but it sounds like you didn't.

      I just quickly wrote the job because I was about to refresh a database and didn't want to lose it without much google searching.

      Delete
  2. A lot of students consider Morphx quite difficult as the settings are not easy to understand but essay writing services has made it quite easy and for the professionals as well as thee students who are new in this field and want to grow.

    ReplyDelete