![]() |
VOOZH | about |
dotnet add package Hyperbee.Migrations --version 3.1.0
NuGet\Install-Package Hyperbee.Migrations -Version 3.1.0
<PackageReference Include="Hyperbee.Migrations" Version="3.1.0" />
<PackageVersion Include="Hyperbee.Migrations" Version="3.1.0" />Directory.Packages.props
<PackageReference Include="Hyperbee.Migrations" />Project file
paket add Hyperbee.Migrations --version 3.1.0
#r "nuget: Hyperbee.Migrations, 3.1.0"
#:package Hyperbee.Migrations@3.1.0
#addin nuget:?package=Hyperbee.Migrations&version=3.1.0Install as a Cake Addin
#tool nuget:?package=Hyperbee.Migrations&version=3.1.0Install as a Cake Tool
A versioned, journaled migration framework for .NET that supports relational and NoSQL databases through a single, consistent API.
Documentation: https://stillpoint-software.github.io/hyperbee.migrations/
Database schema and data evolve over the life of an application. Hyperbee.Migrations gives you a structured, version-controlled way to evolve them across every environment -- local, test, staging, production -- with the same discipline you bring to source code. Migrations live in your repo as C# classes (or as embedded resource files), are discovered by reflection at runtime, and execute exactly once per environment.
v3.0 adds migration squashing across all five providers, plus the tooling and discovery surface that supports it:
[N..M] into a single equivalent squash migration. Mature
environments auto-mark the squash via the Replaces graph (no re-run);
fresh installs run the squash body. Squashes are up-only and carry a
content checksum + Kind/Replaces ledger metadata.hyperbee-migrations CLI. Generates squash artifacts against an
ephemeral, topology-matched container, runs a verification round, and
emits the squash body + sidecar metadata + summary. Also hosts the
recover from-mid-range verb for the documented mid-range recovery
path. The CLI references zero provider packages -- it discovers
providers through the migration assembly's reference closure..Squash provider packages. Hyperbee.Migrations.Providers.<P>.Squash
(Postgres, Aerospike, MongoDB, OpenSearch, Couchbase) each implement the
shared ISquashProvider contract (provider-specific snapshot capture +
canonicalization + verification). Install the .Squash package
alongside the provider package to enable hyperbee-migrations squash --provider <p> for that store.IMigrationHost discovery. A migration project exposes
exactly one IMigrationHost that builds a configured service provider
for an arbitrary connection. The CLI, the recovery verb, and the runner
all consume the same host through a single reflection scan -- the v1
Postgres-only static-method convention is gone.Upgrading from v2: existing v2 migrations continue to work unchanged; squash is additive. See the and the squashing migrations guide.
| Provider | Package | Statement format | Locking |
|---|---|---|---|
| Aerospike | Hyperbee.Migrations.Providers.Aerospike |
AQL-like | CREATE_ONLY record + TTL |
| Couchbase | Hyperbee.Migrations.Providers.Couchbase |
N1QL | Couchbase.Extensions.Locks |
| MongoDB | Hyperbee.Migrations.Providers.MongoDB |
shell-like | document conditional write |
| OpenSearch | Hyperbee.Migrations.Providers.OpenSearch |
OpenSearch DSL | op_type=create + realtime GET |
| PostgreSQL | Hyperbee.Migrations.Providers.Postgres |
raw .sql files |
session-level advisory lock |
Targets .NET 8, 9, and 10. Each provider package is shipped independently on NuGet.
dotnet add package Hyperbee.Migrations.Providers.Postgres
Or whichever provider matches your store. The core Hyperbee.Migrations library is referenced transitively.
// Program.cs
using Hyperbee.Migrations.Providers.Postgres;
var builder = WebApplication.CreateBuilder( args );
// Register the Npgsql data source the migration runner reads from.
builder.Services.AddNpgsqlDataSource( builder.Configuration.GetConnectionString( "Migrations" ) );
builder.Services.AddPostgresMigrations( opts =>
{
opts.SchemaName = "migration"; // ledger schema (default: "migration")
// LockingEnabled defaults to true in v3.0 (production-safe). Set false
// explicitly only for dev/test fixtures that intentionally race.
} );
var app = builder.Build();
using ( var scope = app.Services.CreateScope() )
{
// Single-provider host: resolve the typed runner. Resolving the base
// MigrationRunner also works in single-provider hosts, but the typed
// runner is the documented entry point and the only one that works in
// multi-provider hosts (a multi-provider host throws on
// GetRequiredService<MigrationRunner>() to prevent silently routing to
// the wrong provider).
var runner = scope.ServiceProvider.GetRequiredService<PostgresMigrationRunner>();
await runner.RunAsync( app.Lifetime.ApplicationStopping );
}
app.Run();
Multi-provider hosts. When you call more than one
Add{Provider}Migrationson the same service collection (e.g. one app applies Postgres + MongoDB migrations),GetRequiredService<MigrationRunner>()throws to prevent silently routing to the wrong provider. Resolve the typed runner directly:PostgresMigrationRunner,MongoDBMigrationRunner,CouchbaseMigrationRunner,OpenSearchMigrationRunner,AerospikeMigrationRunner. See multi-provider hosts for the full pattern.
A migration is a class:
using Hyperbee.Migrations;
[Migration( 20260101_001 )]
public class CreateUsersTable( PostgresResourceRunner<CreateUsersTable> runner ) : Migration
{
public override Task UpAsync( CancellationToken ct = default )
=> runner.AllSqlFromAsync( ct );
}
The companion resource file Resources/20260101_001_CreateUsersTable.sql ships in the assembly via <EmbeddedResource>.
For detailed walk-throughs by provider, see the documentation site:
A single application can register migrations for more than one provider:
builder.Services
.AddPostgresMigrations( opts => { /* ... */ } )
.AddMongoDBMigrations( opts => { /* ... */ } );
// Resolve typed runners; the base MigrationRunner resolution throws in
// multi-provider hosts to prevent silent shadowing.
var pg = sp.GetRequiredService<PostgresMigrationRunner>();
var mg = sp.GetRequiredService<MongoDBMigrationRunner>();
See Multi-Provider Hosts for the full pattern, failure-isolation samples, and the expand/contract recipe for cross-store changes.
| Path | Contents |
|---|---|
| Core: runner, options, record-store contract, conventions, resource helpers | |
| Per-provider implementations | |
| Per-provider standalone runner executables (Docker-ready) | |
| Working samples per provider | |
| Jekyll documentation source (just-the-docs) | |
| Architecture Decision Records | |
| Unit + Testcontainers integration tests |
| Concepts & guides | https://stillpoint-software.github.io/hyperbee.migrations/ |
| Operator guides | |
| Changelog |
Requires .NET 8, 9, and 10 SDKs (the solution multi-targets all three for compatibility testing).
git clone https://github.com/Stillpoint-Software/hyperbee.migrations.git
cd hyperbee.migrations
dotnet build Hyperbee.Migrations.slnx -c Release
dotnet test Hyperbee.Migrations.slnx -c Release
Integration tests use Testcontainers and require a Docker engine. They are gated behind #if INTEGRATIONS; enable with -p:EnableIntegrationTests=true.
The framework API draws on prior art in the .NET migration space:
See for the build/test/PR flow. We use a trunk-based GitHub flow; please open an issue to discuss substantial changes before sending a PR.
Released under the .
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 5 NuGet packages that depend on Hyperbee.Migrations:
| Package | Downloads |
|---|---|
|
Hyperbee.Migrations.Providers.Postgres
PostgreSQL provider for Hyperbee.Migrations. Versioned, journaled migration framework with raw .sql resources via PostgresResourceRunner, session-level advisory lock distribution (ADR-0005), per-provider MigrationRunner subclass for multi-provider hosts, and squash codegen via PgDumpSnapshotStrategy (canonical pg_dump --schema-only output). |
|
|
Hyperbee.Migrations.Providers.MongoDB
MongoDB provider for Hyperbee.Migrations. Versioned, journaled migration framework with MongoDB statement-form resources, collection-level distributed locking via findOneAndUpdate, per-provider MigrationRunner subclass for multi-provider hosts, and squash codegen via IntrospectionSnapshotStrategy with BSON Extended JSON canonical output. |
|
|
Hyperbee.Migrations.Providers.Couchbase
Couchbase provider for Hyperbee.Migrations. Versioned, journaled migration framework with N1QL statement-form resources, REST + N1QL hybrid bootstrap, mutex-based distributed locking, per-provider MigrationRunner subclass for multi-provider hosts, and squash codegen via HybridStrategy (combines N1QL system tables + Management REST). |
|
|
Hyperbee.Migrations.Providers.OpenSearch
OpenSearch provider for Hyperbee.Migrations. Versioned, journaled migration framework with rich statement grammar (index/template/component/policy/alias/reindex), split ledger/lock indices (ADR-0018), pluggable bootstrap pipeline, per-provider MigrationRunner subclass for multi-provider hosts, and squash codegen via RestStateDiffStrategy with opaque painless preservation. |
|
|
Hyperbee.Migrations.Providers.Aerospike
Aerospike provider for Hyperbee.Migrations. Versioned, journaled migration framework with AQL statement-form resources, native distributed locking via single-record sentinel, per-provider MigrationRunner subclass for multi-provider hosts, and squash codegen via InfoSnapshotStrategy. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.1.0 | 321 | 5/29/2026 |
| 3.0.0 | 310 | 5/17/2026 |
| 2.2.0 | 1,373 | 5/4/2026 |
| 2.1.1 | 211 | 4/14/2026 |
| 2.1.0 | 170 | 4/12/2026 |
| 2.0.8 | 209 | 1/21/2026 |
| 2.0.7 | 479 | 12/23/2025 |
| 2.0.3 | 791 | 4/14/2025 |
| 2.0.3-develop.250414153512 | 235 | 4/14/2025 |
| 2.0.2 | 264 | 3/17/2025 |
| 2.0.2-develop.250317161245 | 198 | 3/17/2025 |
| 2.0.1 | 216 | 2/17/2025 |
| 2.0.0 | 225 | 11/21/2024 |
| 2.0.0-develop.241121151205 | 130 | 11/21/2024 |
| 2.0.0-develop.241121145735 | 122 | 11/21/2024 |
| 1.2.7 | 412 | 4/30/2024 |
| 1.2.7-develop.240430153808 | 134 | 4/30/2024 |
| 1.2.7-develop.240430124929 | 159 | 4/30/2024 |