MSTKit.MigrationRunner 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package MSTKit.MigrationRunner --version 1.0.1
                    
NuGet\Install-Package MSTKit.MigrationRunner -Version 1.0.1
                    
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="MSTKit.MigrationRunner" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MSTKit.MigrationRunner" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="MSTKit.MigrationRunner" />
                    
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 MSTKit.MigrationRunner --version 1.0.1
                    
#r "nuget: MSTKit.MigrationRunner, 1.0.1"
                    
#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 MSTKit.MigrationRunner@1.0.1
                    
#: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=MSTKit.MigrationRunner&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=MSTKit.MigrationRunner&version=1.0.1
                    
Install as a Cake Tool

MSTKit.MigrationRunner

NuGet Version NuGet Downloads License

An elegant, enterprise-grade, standalone FluentMigrator runner powered by Spectre.Console.

MSTKit.MigrationRunner wraps the standard FluentMigrator engine in a beautiful, interactive CLI with a modern "DevOps Classic" color palette. Say goodbye to boring, unreadable database migration logs!


✨ Features

  • Beautiful UI: Replaces standard console output with highlighted SQL syntax, transaction states, and execution times using Spectre.Console.
  • Auto-Database Creation: Automatically detects if the target SQL Server database exists and creates it if it doesn't.
  • Idiot-Proof Configuration: Provides clear, visual error panels if appsettings.json or connection strings are missing.
  • Interactive & Headless Modes: Perfect for both local development (interactive prompts) and CI/CD pipelines (headless execution).
  • Safe Rollbacks: Easily rollback the last migration or revert to a specific version safely.

📦 Installation

Install the package via NuGet Package Manager Console:

Install-Package MSTKit.MigrationRunner

Or via the .NET Core command-line interface:

dotnet add package MSTKit.MigrationRunner

🚀 Quick Start

1. Configure your Application

In your target project (e.g., a Console App), simply call the MigrationCli.Run method and pass your arguments and the assembly containing your FluentMigrator migration classes.

using System.Reflection;
using MSTKit.MigrationRunner;

namespace YourApp.DatabaseSetup;

public class Program
{
    public static void Main(string[] args)
    {
        // Pass CLI arguments and the assembly containing your migrations
        MigrationCli.Run(args, Assembly.GetExecutingAssembly());
    }
}

2. Add Configuration

Create an appsettings.json file in the root of your executable project. Ensure its properties are set to "Copy to Output Directory: Copy if newer".

{
  "PersistenceConfig": {
    "ConnectionString": "Server=localhost;Database=MyAwesomeDb;User Id=sa;Password=YourPassword123!;TrustServerCertificate=True"
  }
}

3. Write a Migration

Create a standard FluentMigrator class in your project:

using FluentMigrator;

namespace YourApp.DatabaseSetup.Migrations;

[Migration(202610171200)]
public class InitialMigration : Migration
{
    public override void Up()
    {
        Create.Table("Users")
            .WithColumn("Id").AsInt32().PrimaryKey().Identity()
            .WithColumn("Username").AsString(50).NotNullable();
    }

    public override void Down()
    {
        Delete.Table("Users");
    }
}

🛠️ CLI Usage

Run your application from the terminal. If you run it without arguments, it will present a beautiful interactive menu.

Interactive Menu

dotnet run

Prompts you to choose: Migrate UP, Rollback 1 step, Rollback to version, or Cancel.

Non-Interactive (CI/CD Pipelines)

You can bypass the interactive menu by passing arguments (great for GitHub Actions / Docker):

  • Migrate Up to Latest:

    dotnet run -- --auto
    
  • Rollback 1 Step:

    dotnet run -- --rollback
    # or
    dotnet run -- -r
    
  • Rollback to Specific Version:

    dotnet run -- --target=202610171200 --auto
    
  • Run without waiting for user input at the end:

    dotnet run -- --no-wait
    

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

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 was computed.  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.5 76 10/19/2026
1.0.4 79 10/19/2026
1.0.3 81 10/19/2026
1.0.2 80 10/19/2026
1.0.1 122 10/16/2026
1.0.0 80 10/16/2026