Ekmungai.Journey 1.0.0

There is a newer version of this package available.
See the version list below for details.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Ekmungai.Journey --version 1.0.0
                    
NuGet\Install-Package Ekmungai.Journey -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ekmungai.Journey" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ekmungai.Journey" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Ekmungai.Journey" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Ekmungai.Journey --version 1.0.0
                    
#r "nuget: Ekmungai.Journey, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Ekmungai.Journey@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Ekmungai.Journey&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Ekmungai.Journey&version=1.0.0
                    
Install as a Cake Tool

Welcome to Journey

.NET License: MIT

Journey is a script based database migration tool that treats a migration a journey, a collection of steps taken from the beginning (origin) state of the database to the final (destination) state.

Why Journey?

Code/Database Version decoupling

Most if not all migration tools available make the assumption that the version of the database will always be in sync with, and therefore should be updated in tandem with changes to the code using version control. This assumption results with all migrations up to the latest being applied whenever the source code is deployed. While this might be sufficient for a majority of cases, there are circumstances where the code goes out of sync with the database at which point the one can either make another deployment to rollback the database or update the code to a version compatible with it. In either case CI pipelines can make this process long and cumbersome.

Using stepwise migration decouples the deployment of the code versions from the database allowing for surgically precise database versioning via configuration rather than source control.

Enhanced Developer Experience

By allowing them to up and downgrade their local database to any step in the migration journey, the tool allows fine control over the data in contact with the sections of code that each developer/team is working on, while at the same time still maintaining sync across the organization since all migration scripts are checked into version control. This can be particularly useful when revisiting legacy code for refactoring/optimization.

In Built Atomicity

Each step is prepared in a standard format that ensures that both migrations and rollbacks are atomic. To assist with this, the tool provides a scaffold mode that produces a template with all the required sections prefilled and only awaiting the queries for making the actual changes to the database.

Each version file is validated before execution which when combined with a dry run mode which both applies the migration and rolls it back immediately, the tool provides a layer of safety however limited against irrecoverable damage to the database.

Supported Databases

  • Sql Databases
    • Postgres
      • CoackroachDb
      • TimescaleDb
    • Mysql
      • MariaDb
    • Mssql
    • Sqlite
  • NoSql Databases
    • Cassandra

Usage

Production

To make use of Journey in an .NET production application, install it as a Nuget package:

Install-Package Journey

Then during the startup of the application, add the following code:

# initialize the library
var journey = new JourneyFacade(databaseType, connectionString, versionsDirectory); 
# initialize migrations (in quiet mode) in case its the first time
await journey.init(true);
# sync the database
await journey.Update();

This will sync the database to the highest version available in the versionsDirectory. If you'd like to migrate up/down to a specific version, you can provide the target version number to the update function.

Logging

By default, journey logs messages to the console using its internal logger. You can provide a custom logger by calling the UseSerilogLogging and UseMicrosoftLogging`methods just before caling the update method.

# use a pre initialized serilog logger
journey.UseSerilogLogging(logger);
# use a pre initialized microsoft logger/loger factory
journey.UseSerilogLogging(logger);
# Or
journey.UseSerilogLogging(loggerFactory);
await journey.Update(versionNumber);

Development

For local development, the Journey.Command tool is best suited. You can download it from the releases page.

Scaffolding

The first step is to prepare the file version of the database, which you do by running the scaffold command.

journey scaffold -p "path\to\versions-dir" -d sqlite -c "Data Source=journal.db"

This will create a template with the sections required by the journey tool pre filled, as well as instructions on how to put in custom queries for your migration.

NB: When running the tool against a database for the first time, you'll be prompted to confirm that you wish to initialize journey migrations on it. Confirming the prompt will create and apply a migration file that sets up the versions table.

Validation

After you've entered your queries in the migration and rollback section, the next section is to verify that your new migration file is actually runnable by the tool. You do this by running the validate command.

journey validate -p "path\to\versions-dir" -d sqlite -c "Data Source=journal.db"

Any errors found in the document will be reported together with the exact line number where the error occurs.

Migrating

Now that we have valid migration file, the next step is to apply it. We accomlpish this with the migrate command.

journey migrate -p "path\to\versions-dir" -d sqlite -c "Data Source=journal.db"
Rollback

In case the changes applied are not what we expected, we can reset the database to what it was before the migration using the rollback command.

journey rollback -p "path\to\versions-dir" -d sqlite -c "Data Source=journal.db"
Update

To sync the database to the highest version in the verisons directory, run the update command.

journey update -p "path\to\versions-dir" -d sqlite -c "Data Source=journal.db"
History

If you want to view the metatdata of the migrations applied to the database up to the current version, run the history command.

journey history -p "path\to\versions-dir" -d sqlite -c "Data Source=journal.db"

Documentation

You can read extensive documentation about Journey here.

Changelog

Details of changes made are documented for each release.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 58 8/23/2025