Migration Utility

Migration Utility

March 31st, 2022: Ed-Fi Alliance announced EOL for ODS Migration utility. While the utility could be used for upgrade to Ed-Fi ODS / API v5.3 version for both SQL Server and PostgreSQL, there will be no new migration support or enhancements to this product. 

Overview

The ODS Migration Utility is a command-line tool built to upgrade the schema of an ODS instance up to the latest version, along with data migration.

It currently supports data migration from Ed-Fi Data Standard v2.0 and Ed-Fi Data Standard v2.2 to Ed-Fi Data Standard v3.3. The utility has out-of-the-box support for migrating an as-shipped ODS to the latest version. With additional customized scripting, the Migration Utility can be easily adapted and used to migrate extended ODS instances. ODS shared instances may take advantage of this utility. For year-specific instances, migration may not be a concern as a new ODS is created at the beginning of every school year.

Contents:

Usage Scenarios

The following table summarizes the supported scenarios for the migration utility:

Database Type

Databases

Upgrade/Migration strategy

Database Type

Databases

Upgrade/Migration strategy

Core Databases 
Databases that surface the Ed-Fi model and store user data.

EdFi_Ods, EdFi_Ods_YYYY, EdFi_Ods_Sandbox

The current migration utility release  supports an in-place upgrade for the following upgrade paths for SQL Server:

2.4 -> 5.3
2.5 -> 5.3
3.0 -> 5.3

and following upgrade path for PostgreSQL:

3.4 -> 5.3

 

The migration utility also supports migrating extensions with additional custom scripts.

Support Databases
Databases that provide supporting functions and store user data.

EdFi_Admin, EdFi_Security, EdFi_Bulk

These databases can either be recreated, or database deployment tool can be used to migrate them.

Transient Databases
Databases that either surface the Ed-Fi model or perform supporting functions, but do not have user data persistence requirements.

EdFi_ODS_Empty, EdFi_Ods_Minimal_Template EdFi_Ods_Populated_Template

No upgrade supported.

 

Developer Quick Start

The basic steps are simple:

  • Restore a backup copy of the target ODS to your local SQL Server instance. We recommend:

  • Make sure .NET Core 3.1 SDK is installed.

  • Choose one of the two options below to launch the migration utility:

Step 1. Install the Ed-Fi ODS Migration tool: c:\>mkdir {YourInstallFolder} c:\>dotnet tool install EdFi.Suite3.Ods.Utilities.Migration --tool-path {YourInstallFolder} --version 2.2.* Note: As onetime setup, you may need to add Ed-Fi package source by running the following  command in PowerShellprompt using the following command:   if (-not [Net.ServicePointManager]::SecurityProtocol.HasFlag([Net.SecurityProtocolType]::Tls12)) { [Net.ServicePointManager]::SecurityProtocol += [Net.SecurityProtocolType]::Tls12 } Register-PackageSource -Name Ed-FiAzureArtifacts -Location https://pkgs.dev.azure.com/ed-fi-alliance/Ed-Fi-Alliance-OSS/_packaging/EdFi/nuget/v3/index.json -ProviderName NuGet Step 2. Open a console window and change to the directory containing the executable CD {YourInstallFolder} Step 3. Launch the upgrade tool from the command line Example Command Line Arguments: Grand Bend ODS .\EdFi.Ods.Utilities.Migration --DATABASE "YOUR_DATABASE_CONNECTION_STRING_HERE" --DescriptorNamespace "uri://grandbend.org" --CredentialNamespace "uri://grandbend.org" --Engine "YOUR_DATABASE_ENGINE_TYPE"
Step 1. Clone git repository: https://github.com/Ed-Fi-Exchange-OSS/Ed-Fi-MigrationUtility Step 2. Open the Visual Studio solution file, Migration.sln. Step 3. Set up command line input for debugging in Visual Studio 2019: Right click the EdFi.Ods.Utilities.Migration project. Select properties. Select debug. Add command line arguments: Example Command Line Arguments: Grand Bend ODS --DATABASE "YOUR_DATABASE_CONNECTION_STRING_HERE" --DescriptorNamespace "uri://grandbend.org" --CredentialNamespace "uri://grandbend.org" --Engine "YOUR_DATABASE_ENGINE_TYPE" Step 4. Set the EdFi.Ods.Utilities.Migration project as your startup project. Step 5. Launch in debug mode (F5).

Downloads

Ed-Fi ODS Migration Utility binaries: EdFi.Suite3.Ods.Utilities.Migration v2.2 (Prerequisite: .NET Core 3.1 SDK)

Ed-Fi ODS Migration Utility source code, hosted on Ed-Fi Alliance GitHub: https://github.com/Ed-Fi-Exchange-OSS/Ed-Fi-MigrationUtility

Example calendar configuration files: Sample Calendar Config

Development Overview: The Basics

The table below describes files and folders used by the Migration Utility along with a description and purpose for each resource.

Overview Item

Needed by Whom?

Brief Description & Purpose

Overview Item

Needed by Whom?

Brief Description & Purpose

Script Directory:
\Scripts

  • Users writing custom upgrade scripts

  • Maintainers of the upgrade utility

  • All database upgrade scripts go here, including:

    • Ed-Fi upgrade scripts.

    • Custom upgrade scripts (user extensions).

    • Compatibility checks.

    • Dynamic / SQL-based validation.

  • Subdirectories contain code for each supported ODS upgrade version.

Directory:
\Descriptors

  • Maintainers of the upgrade utility only

  • Ed-Fi-Standard XML files containing Descriptors for each ODS version.

  • These XML files are imported directly by the scripting in the Utilities\Migration\Scripts directory above.

Library/Console:
EdFi.Ods.Utilities.Migration

(console application created via dotnet publish)

  • Maintainers of the upgrade utility only

  • Small, reusable library making use of DbUp to drive the main upgrade.

  • Executes the SQL scripts contained in the Utilities\Migration\Scripts directory above.

  • Takes a configuration object as input, and chooses the appropriate scripts to execute based on ODS version and current conventions.

Test Project:
EdFi.Ods.Utilities.Migration.Tests

  • Maintainers of the upgrade utility only (does not contain test coverage for extensions)

  • Contains integration tests that perform a few test upgrades and assert that the output is as expected.

  • Like the console utility, makes direct use of the EdFi.Ods.Utilities.Migration library described above.

Development Troubleshooting

This section outlines general troubleshooting procedures.

Compatibility Errors

  • Before the schema is updated, the ODS data is checked for compatibility. If changes are required, the upgrade will stop and exception will be thrown with instructions on how to proceed. 
    An example error message follows:

Example compatibility error
  • After making the required changes (or writing custom scripts), simply launch the upgrade utility again. The upgrade will proceed where it left off and retry with the last script that failed.

Other Exceptions During Development

  • Similar to compatibility error events, the upgrade will halt and an exception message will be generated during development if a problem is encountered.

  • After making updates to the script that failed, simply re-launch the update tool. The upgrade will proceed where it left off starting with the last script that failed. 

  • If you are testing a version that is not yet released, or if you need to re-execute scripts that were renamed or modified during active development: restore your database from backup and start over.

  • Similar to other database migration tools, a log of scripts successfully executed will be stored in the default journal table. DbUp's default location is [dbo].[SchemaVersions].

  • A log file containing errors/warnings from the most recent run may be found by default in "{YourInstallFolder}\.store\edfi.suite3.ods.utilities.migration\{YourMigrationUtilityVersion}\edfi.suite3.ods.utilities.migration\{YourMigrationUtilityVersion}\tools\netcoreapp3.1\any\Ed-Fi-Migration.log".

Additional Troubleshooting

  • The step-by-step usage guide below contains runtime troubleshooting information.