Core migration framework and abstractions for DbReactor .NET database migration system. Provides database-agnostic interfaces, configuration management, and migration orchestration.
$ dotnet add package DbReactor.CoreDbReactor is a powerful, extensible .NET database migration framework that provides version-controlled, repeatable database schema management. It supports multiple script types, database providers, and offers comprehensive tracking and rollback capabilities.
DbReactor is split into separate NuGet packages:
dotnet add package DbReactor.Coredotnet add package DbReactor.MSSqlServerMore database providers coming soon...
Choose your database provider to get started:
# Install packages
dotnet add package DbReactor.Core
dotnet add package DbReactor.MSSqlServer
using DbReactor.MSSqlServer.Extensions;
var config = new DbReactorConfiguration()
.UseSqlServer(connectionString)
.UseStandardFolderStructure(typeof(Program).Assembly)
.UseConsoleLogging()
.CreateDatabaseIfNotExists();
var engine = new DbReactorEngine(config);
var result = await engine.RunAsync();
That's it! See the quick start guides for detailed setup instructions.
DbReactor uses a modular architecture with clear separation of concerns:
DbReactor.Core)// Database provider interfaces
IConnectionManager // Database connections
IScriptExecutor // Script execution
IMigrationJournal // Migration tracking
IDatabaseProvisioner // Database creation
// Core interfaces
IScriptProvider // Script discovery
ILogProvider // Logging
ICodeScript // C# migration scripts
// Program.cs
var config = new DbReactorConfiguration()
.UseSqlServer("Server=localhost;Database=MyApp;Trusted_Connection=true;")
.UseStandardFolderStructure(typeof(Program).Assembly)
.UseConsoleLogging();
var engine = new DbReactorEngine(config);
await engine.RunAsync();
Scripts/
├── upgrades/
│ ├── M001_CreateUsersTable.sql
│ ├── M002_SeedUsers.cs
│ └── M003_CreateIndexes.sql
└── downgrades/
├── M001_CreateUsersTable.sql
├── M002_SeedUsers.sql
└── M003_CreateIndexes.sql
DbReactor is designed to be extensible. Create custom database providers by implementing the core interfaces:
public static class MyDatabaseExtensions
{
public static DbReactorConfiguration UseMyDatabase(this DbReactorConfiguration config, string connectionString)
{
return config
.UseConnectionManager(new MyConnectionManager(connectionString))
.UseScriptExecutor(new MyScriptExecutor())
.UseMigrationJournal(new MyMigrationJournal())
.UseDatabaseProvisioner(new MyDatabaseProvisioner());
}
}
We welcome contributions! See CONTRIBUTING.md for guidelines.
[Your License Here]
Ready to get started? Choose your database provider and follow the quick start guide!