Curiosity.Migrations
4.3.1
dotnet add package Curiosity.Migrations --version 4.3.1
NuGet\Install-Package Curiosity.Migrations -Version 4.3.1
<PackageReference Include="Curiosity.Migrations" Version="4.3.1" />
<PackageVersion Include="Curiosity.Migrations" Version="4.3.1" />
<PackageReference Include="Curiosity.Migrations" />
paket add Curiosity.Migrations --version 4.3.1
#r "nuget: Curiosity.Migrations, 4.3.1"
#addin nuget:?package=Curiosity.Migrations&version=4.3.1
#tool nuget:?package=Curiosity.Migrations&version=4.3.1
Curiosity.Migrations
![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?
<table> <tr> <td width="50%" valign="top"> <h3>๐ง Precise Control</h3> <p>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.</p> </td> <td width="50%" valign="top"> <h3>๐ Production-Ready</h3> <p>Built for enterprise applications with safety features, long-running migration support, and granular policies to control what runs in each environment.</p> </td> </tr> <tr> <td width="50%" valign="top"> <h3>๐ Bidirectional</h3> <p>First-class support for downgrade migrations enables safe rollbacks when deployments don't go as planned.</p> </td> <td width="50%" valign="top"> <h3>๐ Progressive Migrations</h3> <p>Separate long-running data migrations from quick schema changes to keep your application responsive during upgrades.</p> </td> </tr> <tr> <td width="50%" valign="top"> <h3>๐งช Testability</h3> <p>Create and initialize test databases with specific migration states for reliable integration testing.</p> </td> <td width="50%" valign="top"> <h3>๐งฉ Extensibility</h3> <p>Customize where migrations come from, how they're logged, and how they're applied to fit your workflow.</p> </td> </tr> </table>
Core Features
Migration Types
Script Migrations: Write raw SQL for direct database access
- Batched Execution: Split large scripts into manageable chunks
- Full support for database-specific SQL features and optimizations
Code Migrations: Implement migrations in C# for complex scenarios
- Dependency Injection: Use your application's services in migrations
- Entity Framework Integration: Leverage EF Core when needed
- Implement custom validation, logging, or business logic during migrations
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
- Migration Providers: Source migrations from files, embedded resources, etc.
- Variables: Dynamic value substitution in migrations
- Pre-migrations: Run setup scripts before main migrations
- Custom Journal: Configure how applied migrations are tracked
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
<table> <tbody> <tr> <td align="center" valign="middle"> <img src="https://raw.githubusercontent.com/siisltd/Curiosity.Migrations/master/docs/images/postgresql.png" width="200"> <br> <b>PostgreSQL</b> </td> <td align="center" valign="middle"> <img src="https://raw.githubusercontent.com/microsoft/sqlserver-graphics/main/Microsoft%20SQL%20Server/SVG/SQL%20Server%20logo%20(2022).svg" width="200"> <br> <b>SQL Server</b> </td> </tr> </tbody> </table>
Support for additional databases can be added through contributions.
Comparing with Alternatives
<table> <thead> <tr> <th>Feature</th> <th>Curiosity.Migrations</th> <th>EF Core Migrations</th> <th>FluentMigrator</th> <th>DbUp</th> </tr> </thead> <tbody> <tr> <td>Direct SQL Control</td> <td>โ Full</td> <td>โ ๏ธ Generated</td> <td>โ ๏ธ Generated</td> <td>โ Full</td> </tr> <tr> <td>Code Migrations</td> <td>โ Native</td> <td>โ ๏ธ Limited</td> <td>โ ๏ธ Via API</td> <td>โ No</td> </tr> <tr> <td>Downgrade Support</td> <td>โ First-class</td> <td>โ ๏ธ Limited</td> <td>โ ๏ธ Limited</td> <td>โ No</td> </tr> <tr> <td>Long-running Migrations</td> <td>โ Optimized</td> <td>โ No</td> <td>โ No</td> <td>โ No</td> </tr> <tr> <td>Migration Policies</td> <td>โ Configurable</td> <td>โ No</td> <td>โ No</td> <td>โ No</td> </tr> <tr> <td>DI Support</td> <td>โ Native</td> <td>โ ๏ธ Limited</td> <td>โ ๏ธ Limited</td> <td>โ ๏ธ Basic</td> </tr> <tr> <td>Best For</td> <td>Enterprise apps, complex migrations, performance-critical systems</td> <td>Simple CRUD apps with EF Core</td> <td>Cross-database projects</td> <td>Simple script runners</td> </tr> </tbody> </table>
For more detailed comparisons, see The Philosophy Behind Curiosity.Migrations.
Available Packages
Package | Version | Downloads |
---|---|---|
Curiosity.Migrations | ||
Curiosity.Migrations.PostgreSQL | ||
Curiosity.Migrations.SqlServer |
Documentation
- Quick Start Guide - Getting started with Curiosity.Migrations
- Core Concepts - Understanding the fundamental concepts
- The Philosophy Behind Curiosity.Migrations - Why this library exists
- Feature Documentation - Detailed guides for each feature
- Supported Databases - Currently supported database systems
Community and Support
- GitHub Issues - Report bugs or request features
- GitHub Discussions - Ask questions and discuss ideas
License
Curiosity.Migrations is licensed under the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.1
- Microsoft.Extensions.DependencyInjection (>= 6.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
-
.NETStandard 2.0
- Microsoft.Extensions.DependencyInjection (>= 6.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
-
.NETStandard 2.1
- Microsoft.Extensions.DependencyInjection (>= 6.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
-
net6.0
- Microsoft.Extensions.DependencyInjection (>= 6.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
-
net7.0
- Microsoft.Extensions.DependencyInjection (>= 6.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Curiosity.Migrations:
Package | Downloads |
---|---|
Curiosity.Migrations.PostgreSQL
Curiosity.Migrations is a migration framework that uses SQL scripts and code migration to alter your database schema or seed a data. |
|
Curiosity.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). |
|
Curiosity.Migrations.SqlServer
Curiosity.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 |
---|---|---|
4.3.1 | 152 | 5/1/2025 |
4.3.0 | 332 | 11/14/2023 |
4.2.0 | 262 | 4/21/2023 |
4.1.3 | 300 | 4/14/2023 |
4.1.2 | 227 | 4/12/2023 |
4.1.1 | 211 | 4/12/2023 |
4.0.2 | 219 | 4/12/2023 |
4.0.1 | 455 | 4/10/2023 |
4.0.0 | 343 | 4/10/2023 |
3.1.0 | 490 | 7/29/2022 |
3.0.7 | 507 | 4/21/2022 |
3.0.6 | 494 | 3/1/2022 |
3.0.5 | 459 | 3/1/2022 |
3.0.4 | 897 | 8/3/2021 |
3.0.3 | 527 | 3/8/2021 |
3.0.2 | 606 | 12/10/2020 |
3.0.1 | 455 | 12/9/2020 |
3.0.0 | 568 | 12/8/2020 |
2.2.0 | 631 | 10/16/2020 |
2.1.0 | 632 | 9/21/2020 |
2.0.0 | 697 | 5/14/2020 |
1.2.0 | 674 | 4/23/2020 |
1.1.1 | 693 | 4/1/2020 |
1.1.0 | 701 | 3/24/2020 |
1.0.0 | 736 | 2/11/2020 |