Skip to content

siisltd/Curiosity.Migrations

Repository files navigation

Curiosity.Migrations Build Status License NuGet Downloads Documentation Status

Introduction

Curiosity.Migrations is a powerful, flexible database migration framework for .NET and .NET Core applications that gives you precise control over how your database evolves. It combines the performance and control of raw SQL with the flexibility of C# code migrations, all wrapped in a robust, enterprise-ready migration system.

Unlike ORM-specific migration tools, Curiosity.Migrations is database-focused and designed for scenarios where you need fine-grained control over migration execution, especially for large production databases where performance and safety are critical.

Why Use Curiosity.Migrations?

πŸ”§ Precise Control

Write raw SQL when you need optimal performance, or use C# code when you need complex logic. You control exactly what runs against your database.

πŸš€ Production-Ready

Built for enterprise applications with safety features, long-running migration support, and granular policies to control what runs in each environment.

πŸ”„ Bidirectional

First-class support for downgrade migrations enables safe rollbacks when deployments don't go as planned.

πŸ“Š Progressive Migrations

Separate long-running data migrations from quick schema changes to keep your application responsive during upgrades.

πŸ§ͺ Testability

Create and initialize test databases with specific migration states for reliable integration testing.

🧩 Extensibility

Customize where migrations come from, how they're logged, and how they're applied to fit your workflow.

Core Features

Migration Types

Safety and Control

  • Policies: Control which migrations run in different environments
  • Dependencies: Specify explicit requirements between migrations
  • Downgrade Migrations: Safely roll back changes when needed
  • Transactions: Configure transaction behavior per migration
  • Long-running vs Short-running: Separate quick schema changes from data-intensive operations

Extensibility

Quick Start

Installation

# Install core package
dotnet add package Curiosity.Migrations

# Install database provider (PostgreSQL or SQL Server)
dotnet add package Curiosity.Migrations.PostgreSQL
# or
dotnet add package Curiosity.Migrations.SqlServer

Basic Setup

// Configure the migration engine
var builder = new MigrationEngineBuilder(services)
    .UseScriptMigrations().FromDirectory("./Migrations")  // Add SQL migrations
    .UseCodeMigrations().FromAssembly(Assembly.GetExecutingAssembly())  // Add code migrations
    .ConfigureForPostgreSql("Host=localhost;Database=myapp;Username=postgres;Password=secret")
    .UseUpgradeMigrationPolicy(MigrationPolicy.AllAllowed);

// Build and run the engine
var migrationEngine = builder.Build();
var result = await migrationEngine.UpgradeDatabaseAsync();

// Check results
if (result.IsSuccessful)
{
    Console.WriteLine($"Successfully migrated");
}

Get started quickly with the Quick Start Guide or dive into Core Concepts.

Supported Databases


PostgreSQL

SQL Server

Support for additional databases can be added through contributions.

Comparing with Alternatives

Feature Curiosity.Migrations EF Core Migrations FluentMigrator DbUp
Direct SQL Control βœ… Full ⚠️ Generated ⚠️ Generated βœ… Full
Code Migrations βœ… Native ⚠️ Limited ⚠️ Via API ❌ No
Downgrade Support βœ… First-class ⚠️ Limited ⚠️ Limited ❌ No
Long-running Migrations βœ… Optimized ❌ No ❌ No ❌ No
Migration Policies βœ… Configurable ❌ No ❌ No ❌ No
DI Support βœ… Native ⚠️ Limited ⚠️ Limited ⚠️ Basic
Best For Enterprise apps, complex migrations, performance-critical systems Simple CRUD apps with EF Core Cross-database projects Simple script runners

For more detailed comparisons, see The Philosophy Behind Curiosity.Migrations.

Available Packages

Package Version Downloads
Curiosity.Migrations NuGet NuGet
Curiosity.Migrations.PostgreSQL NuGet NuGet
Curiosity.Migrations.SqlServer NuGet NuGet
Curiosity.Migrations.Utils NuGet NuGet

Community and Support

License

Curiosity.Migrations is licensed under the MIT License.

About

Migrations framework via scripts for .NET Standard

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages