Migrate data and binary files

Now, we will migrate the data from the KX13 (source) instance to the XbyK (target) instance. The video below goes over the migration tool configuration and shows how to run the data migration.

In the video we run the data migration in two iterations:

  • first to migrate sites only.
  • then to migrate the rest of the data necessary to display the Contacts page: settings keys, page types, pages, attachments and forms.

In your own project, you can run the data migration in as many iterations as you wish. To avoid repetitive migration of the same type of object, use the --bypass-dependency-check parameter.

We highly recommend creating a database backup before each iteration.

Under the video, see the sample configuration files, links, and important remarks mentioned in the video.

Configuration

These are sample configuration files used in the video above.

See the explanation of all the configuration options and more examples in the Kentico Migration Tool GitHub documentation.

JS
Migration.Tool.CLI/appsettings.json
...
  "Settings": {
    "MigrationProtocolPath": "<ABSOLUTE_PATH_TO_STORE_THE_-_LOG>\\Migration.Toolkit.Protocol.log",
    "KxConnectionString": "Data Source=<YOUR_DB_SERVER_NAME>;Initial Catalog=<SOURCE_KX13_DB_NAME>;Integrated Security=True;Persist Security Info=False;Connect Timeout=60;Encrypt=False;Current Language=English;",
    "KxCmsDirPath": "<ABSOLUTE_PATH_TO_YOUR_SOURCE_KX13_INSTANCE>\\CMS",
    "XbKDirPath": "<ABSOLUTE_PATH_TO_YOUR_TARGET_XBYK_INSTANCE>\\src",
    "XbyKApiSettings": {
      "ConnectionStrings": {
          "CMSConnectionString": "Data Source=<YOUR_DB_SERVER_NAME>;Initial Catalog=<TARGET_XBYK_DB_NAME>;Integrated Security=True;Persist Security Info=False;Connect Timeout=60;Encrypt=False;Current Language=English;"
      }
    },
    "MigrateOnlyMediaFileInfo": false,
    "MigrateMediaToMediaLibrary": false,
    "LegacyFlatAssetTree": false,
    "AssetRootFolders": {},
    "UseDeprecatedFolderPageType": false,
    "ConvertClassesToContentHub": "",
    "CreateReusableFieldSchemaForClasses": "",
    "OptInFeatures": {
      "QuerySourceInstanceApi": {
        "Enabled": true,
        "Connections": [
          {
            "SourceInstanceUri": "http://localhost:<SOURCE_INSTANCE_PORT>/",
            "Secret": "my_secret"
          }
        ]
      }
    },
...

ToolApiController copied from the Kentico Migration Tool, KX13.Extensions.cs:

C#
/DancingGoatCore/Controllers/ToolApiController.cs
using System.Collections.Generic;
...

public class ToolApiController : Controller
{
    private const string Secret = "my_secret";
    ...
    // the rest of the file stays the same
}

Registering the actions of the ToolApi controller:

C#
/DancingGoatCore/Startup.cs
app.UseEndpoints(endpoints =>
{
    endpoints.Kentico().MapRoutes();

    // added code
    endpoints.MapControllerRoute(
        name: "ToolExtendedFeatures",
        pattern: "{controller}/{action}",
        constraints: new
        {
            controller = "ToolApi"
        }
    );
...
}
...

See the list of data migration steps in our documentation.

For successful data migration, make sure that:

  • Your source instance is running during migration.
  • Your target instance is NOT running during migration.

Create a database backup each time before you run the migrate command.

If you run into issues during the data migration process, check out the Migration Protocol Reference to troubleshoot common errors.

In the video, we utilize Source instance API discovery to ensure the migrated Page Builder data can work with the new Editing components in Xperience by Kentico rather than in the legacy compatibility mode. While it is not a mandatory step, we highly recommend this approach.

Previous step: Set up your environment — Next step: Adjust global code on the backend

Completed steps: 2 of 5