Curiosus.Migrations 6.0.0

dotnet add package Curiosus.Migrations --version 6.0.0
                    
NuGet\Install-Package Curiosus.Migrations -Version 6.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="Curiosus.Migrations" Version="6.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Curiosus.Migrations" Version="6.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Curiosus.Migrations" />
                    
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 Curiosus.Migrations --version 6.0.0
                    
#r "nuget: Curiosus.Migrations, 6.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 Curiosus.Migrations@6.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=Curiosus.Migrations&version=6.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Curiosus.Migrations&version=6.0.0
                    
Install as a Cake Tool

Curiosus.Migrations

NuGet Downloads Coverage

Core engine of Curiosus.Migrations, a database migration framework for .NET that combines raw SQL scripts and C# code migrations. Install it together with a database provider: PostgreSQL or SQL Server.

Installation

dotnet add package Curiosus.Migrations
dotnet add package Curiosus.Migrations.PostgreSQL # or Curiosus.Migrations.SqlServer

Usage

Put SQL scripts named by version (1.0.sql, 1.1-add_users.sql, 2.0.down.sql) into a directory. Then configure and run the engine:

using Curiosus.Migrations;
using Curiosus.Migrations.PostgreSQL;

var engine = new MigrationEngineBuilder(services)
    .UseScriptMigrations().FromDirectory("./Migrations")
    .UseCodeMigrations().FromAssembly(typeof(Program).Assembly)
    .ConfigureForPostgreSql(connectionString)
    .UseUpgradeMigrationPolicy(MigrationPolicy.ShortRunningAllowed)
    .Build();

var result = await engine.UpgradeDatabaseAsync(cancellationToken);
if (!result.IsSuccessfully)
    throw new InvalidOperationException($"{result.ErrorCode}: {result.ErrorMessage}");

The engine creates the database and the migration history table if they do not exist. To register IMigrationEngine as a singleton, call services.AddMigrations(builder => ...) instead.

A code migration is a class derived from CodeMigration:

public class SeedRolesMigration : CodeMigration
{
    public override MigrationVersion Version => new(1, 2);
    public override string? Comment => "Seed default roles";

    public override Task UpgradeAsync(DbTransaction? transaction = null, CancellationToken cancellationToken = default) =>
        MigrationConnection.ExecuteNonQuerySqlAsync("INSERT INTO roles (name) VALUES ('admin');", null, cancellationToken);
}

Key concepts

See also

Product Compatible and additional computed target framework versions.
.NET 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 is compatible.  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 (3)

Showing the top 3 NuGet packages that depend on Curiosus.Migrations:

Package Downloads
Curiosus.Migrations.Utils

Without migrations you need to create a lots of sql scripts that have to be run manually by every developer involved. Migrations solve the problem of evolving a database schema for multiple databases (for example, the developer's local database, the test database and the production database).

Curiosus.Migrations.PostgreSQL

Curiosus.Migrations is a migration framework that uses SQL scripts and code migration to alter your database schema or seed a data.

Curiosus.Migrations.SqlServer

Curiosus.Migrations is a migration framework that uses SQL scripts and code migration to alter your database schema or seed a data.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
6.0.0 58 9/29/2026
5.0.0 59 9/28/2026