RavenMigrations 3.0.0
See the version list below for details.
dotnet add package RavenMigrations --version 3.0.0
NuGet\Install-Package RavenMigrations -Version 3.0.0
<PackageReference Include="RavenMigrations" Version="3.0.0" />
<PackageVersion Include="RavenMigrations" Version="3.0.0" />
<PackageReference Include="RavenMigrations" />
paket add RavenMigrations --version 3.0.0
#r "nuget: RavenMigrations, 3.0.0"
#addin nuget:?package=RavenMigrations&version=3.0.0
#tool nuget:?package=RavenMigrations&version=3.0.0
Raven Migrations
Quick Start
PM > Install-Package RavenDB.Migrations
Introduction
Raven Migrations is a migration framework for RavenDB to help with common tasks you might have to do over time to your database. The framework API is heavily influenced by Fluent Migrator.
Philosophy
We believe any changes to your domain should be visible in your code and reflected as such. Changing things "on the fly", can lead to issues, where as migrations can be tested and throughly vetted before being exposed into your production environment. With RavenDB testing migrations is super simple since RavenDB supports in memory databases (our test suite is in memory).
This is important, once a migration is in your production environment, NEVER EVER modify it in your code. Treat a migration like a historical record of changes.
Concepts
Every migration has several elements you need to be aware of. Additionally, there are over arching concepts that will help you structure your project to take advantage of this library.
A Migration
A migration looks like the following:
// #1 - specify the migration number
[Migration(1)]
public class First_Migration : Migration // #2 inherit from Migration
{
// #3 Do the migration
public override void Up()
{
using (var session = DocumentStore.OpenSession())
{
session.Store(new TestDocument
{
Id = "TestDocuments/1",
Name = "Khalid Abuhakmeh"
});
session.SaveChanges();
}
}
// #4 optional: undo the migration
public override void Down()
{
using (var session = DocumentStore.OpenSession())
{
session.Delete("TestDocuments/1");
session.SaveChanges();
}
}
}
To run the migrations, you can use Microsoft's Dependency Injection:
public void ConfigureServices(IServiceCollection services)
{
// Add the MigrationRunner into the dependency injection container.
services.AddRavenDbMigrations();
// ...
// Get the migration runner and execute pending migrations.
var migrationRunner = services.BuildServiceProvider().GetRequiredService<MigrationRunner>();
migrationRunner.Run();
}
Not using ASP.NET Core? You can create the runner manually:
// Skip dependency injection and run the migrations.
// Create migration options, using all Migration objects found in the current assembly.
var options = new MigrationOptions();
options.Assemblies.Add(Assembly.GetExecutingAssembly());
// Create a new migration runner. docStore is your RavenDB IDocumentStore. Logger is an ILogger<MigrationRunner>.
var migrationRunner = new MigrationRunner(docStore, options, logger);
migrationRunner.Run();
Full documentation and sample project available on the GitHub repo.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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.1 is compatible. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
-
.NETCoreApp 2.1
- Microsoft.Extensions.Configuration (>= 2.1.0)
- Microsoft.Extensions.DependencyInjection (>= 2.1.0)
- Microsoft.Extensions.Logging (>= 2.1.0)
- RavenDB.Client (>= 4.0.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on RavenMigrations:
Repository | Stars |
---|---|
ravendb/samples-yabt
"Yet Another Bug Tracker" solution sample for RavenDB and .NET with Angular UI
|
Version | Downloads | Last updated |
---|---|---|
6.0.2 | 51,710 | 8/2/2024 |
6.0.1 | 24,552 | 1/13/2024 |
6.0.0 | 154 | 1/13/2024 |
5.0.2 | 50,925 | 1/9/2024 |
5.0.1 | 257,847 | 3/21/2022 |
5.0.0 | 53,040 | 7/26/2020 |
4.3.0 | 8,079 | 5/4/2020 |
4.1.7 | 27,941 | 1/21/2019 |
4.1.6 | 782 | 1/18/2019 |
4.1.4 | 788 | 1/4/2019 |
4.1.3 | 755 | 1/3/2019 |
4.1.2 | 836 | 11/27/2018 |
4.1.1 | 1,157 | 10/23/2018 |
4.1.0 | 851 | 10/9/2018 |
4.0.0 | 917 | 9/17/2018 |
3.0.0 | 1,021 | 7/19/2018 |
2.1.0 | 38,473 | 6/20/2016 |
2.0.0 | 2,652 | 1/22/2016 |
1.2.0 | 9,086 | 5/20/2015 |
1.1.0 | 1,174 | 5/18/2015 |
1.0.1 | 2,000 | 7/10/2014 |
1.0.0 | 4,814 | 10/28/2013 |
Upgrade to Raven 4, .NET Core 2.1.