DotNetBrightener.DataAccess.DataMigration 2024.0.13.8-preview

This is a prerelease version of DotNetBrightener.DataAccess.DataMigration.
There is a newer version of this package available.
See the version list below for details.
dotnet add package DotNetBrightener.DataAccess.DataMigration --version 2024.0.13.8-preview                
NuGet\Install-Package DotNetBrightener.DataAccess.DataMigration -Version 2024.0.13.8-preview                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DotNetBrightener.DataAccess.DataMigration" Version="2024.0.13.8-preview" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DotNetBrightener.DataAccess.DataMigration --version 2024.0.13.8-preview                
#r "nuget: DotNetBrightener.DataAccess.DataMigration, 2024.0.13.8-preview"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DotNetBrightener.DataAccess.DataMigration as a Cake Addin
#addin nuget:?package=DotNetBrightener.DataAccess.DataMigration&version=2024.0.13.8-preview&prerelease

// Install DotNetBrightener.DataAccess.DataMigration as a Cake Tool
#tool nuget:?package=DotNetBrightener.DataAccess.DataMigration&version=2024.0.13.8-preview&prerelease                

Data Migration Library for .NET Core Applications

© 2024 DotNet Brightener

Versions

Package Version
DotNetBrightener.DataAccess.DataMigration NuGet Version
DotNetBrightener.DataAccess.DataMigration.Mssql NuGet Version
DotNetBrightener.DataAccess.DataMigration.PostgreSql NuGet Version
dotnet-dnb-datamigration NuGet Version

Overview

Data Migration Library is a simple library to help you manage your data migration in your .NET Core application. It provides a simple way to define your migration classes and run them in your application.

Not all applications can use DACPAC for managing database schema and data changes. Especially DACPAC does not work with other databases such as MySQL, PostgreSQL, etc. This library is designed to help you manage your data migration in your application.

Installation

Install using Package Reference

dotnet add [YOUR_PROJECT_NAME] package DotNetBrightener.DataAccess.DataMigration

If you need to data migration with SQL Server, install the following package: DotNetBrightener.DataAccess.DataMigration.Mssql

dotnet add [YOUR_PROJECT_NAME] package DotNetBrightener.DataAccess.DataMigration.Mssql

For PostgreSQL, install the following package: DotNetBrightener.DataAccess.DataMigration.PostgreSql

dotnet add [YOUR_PROJECT_NAME] package DotNetBrightener.DataAccess.DataMigration.PostgreSql

Usage

Register to Service Collection
// var _connectionString = "<your_connection_string>";

// If you use SQL Server
services.EnableDataMigrations()
        .UseSqlServer(_connectionString);

// If you use PostgreSQL
services.EnableDataMigrations()
        .UseNpgsql(_connectionString);

// if you want to auto detect all migration classes
services.AutoScanDataMigrators();

// if you want to manually register migration classes
services.AddDataMigrator<MyMigration>();

Define your migration classes

using DotNetBrightener.DataAccess.DataMigration;

[DataMigration("<your_migration_id>")]
public class MyMigration : IDataMigration
{
    // You can use Dependency Injection for injecting your services
    private readonly IMyService _myService;

    public MyMigration(IMyService myService)
    {
        _myService = myService;
    }

    public async Task MigrateData()
    {
        // Your migration code here
        await _myService.DoSomethingToMigrateData();
    }
}

Roadmap

  • Initial Release
  • Add Support for SQL Server
  • Add Support for PostgreSQL
  • CLI tool for creating migration class

CLI Tool

You can now install the cli tool from Nuget: dotnet-dnb-datamigration

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on DotNetBrightener.DataAccess.DataMigration:

Package Downloads
DotNetBrightener.DataAccess.DataMigration.Mssql

Package Description

DotNetBrightener.DataAccess.DataMigration.PostgreSql

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2025.0.2-preview-277 83 12/16/2024
2025.0.1-rc-243301701 198 11/25/2024
2024.0.14.6 97 11/25/2024
2024.0.14.6-rc-243031001 173 10/29/2024
2024.0.14.6-rc-243030701 93 10/29/2024
2024.0.14.6-rc-242840501 86 10/10/2024
2024.0.14.6-rc-242820305 82 10/8/2024
2024.0.14.6-rc-242771401 181 10/3/2024
2024.0.14.6-rc-242770501 90 10/3/2024
2024.0.14.6-rc-242770201 94 10/3/2024
2024.0.14.6-rc-242761801 85 10/2/2024
2024.0.14.6-rc-242761601 95 10/2/2024
2024.0.14.6-rc-242761501 82 10/2/2024
2024.0.14.6-rc-242761401 92 10/2/2024
2024.0.14.6-rc-242760701 99 10/2/2024
2024.0.14.6-rc-242751002 85 10/1/2024
2024.0.14.6-rc-242750901 98 10/1/2024
2024.0.14.6-rc-242750502 86 10/1/2024
2024.0.14.6-rc-242750201 91 10/1/2024
2024.0.14.6-rc-242741501 86 9/30/2024
2024.0.14.6-rc-242730701 115 9/29/2024
2024.0.14.6-preview-2730501 80 9/29/2024
2024.0.14.6-preview-2701501 122 9/26/2024
2024.0.14.6-preview-2620901 147 9/18/2024
2024.0.14.6-preview-2570701 90 9/13/2024
2024.0.14.6-preview-2510703 161 9/7/2024
2024.0.14.6-preview-2480501 116 9/4/2024
2024.0.14.6-preview-2430401 130 8/30/2024
2024.0.14.6-preview-242730701 88 9/29/2024
2024.0.14.6-preview-2421703 98 8/29/2024
2024.0.14.6-preview-2421701 95 8/29/2024
2024.0.14.6-preview-2420901 93 8/29/2024
2024.0.14.6-preview-2390101 108 8/26/2024
2024.0.14.6-preview-2381603 125 8/25/2024
2024.0.14.6-preview-2341601 141 8/21/2024
2024.0.14.6-preview-2321602 135 8/20/2024
2024.0.14.6-preview-2190801 160 8/6/2024
2024.0.14.6-preview-2041501 101 7/22/2024
2024.0.14.6-preview-1920603 149 7/10/2024
2024.0.14.6-preview-1920301 116 7/10/2024
2024.0.14.6-preview-1911302 101 7/9/2024
2024.0.14.6-preview-1901001 113 7/8/2024
2024.0.14.6-preview-1900901 96 7/8/2024
2024.0.14.6-preview-1900801 93 7/8/2024
2024.0.14.6-preview-1860304 101 7/4/2024
2024.0.14.5 161 7/1/2024
2024.0.14.5-preview-1811601 108 6/29/2024
2024.0.14.5-preview-1810501 123 6/29/2024
2024.0.14.5-preview-180132 119 6/28/2024
2024.0.14.5-preview-180131 113 6/28/2024
2024.0.14.5-preview-180121 97 6/28/2024
2024.0.14.4 128 6/27/2024
2024.0.14.4-preview-8 108 6/27/2024
2024.0.14.4-preview-7 109 6/27/2024
2024.0.14.3 124 6/21/2024
2024.0.14.1 124 6/6/2024
2024.0.14.1-preview 103 6/6/2024
2024.0.14-preview-1 104 6/6/2024
2024.0.13.8-preview 107 6/6/2024
2024.0.13.1-preview-0146 105 6/6/2024
2024.0.13-preview-1 95 6/6/2024
2024.0.12.15803-preview-03 110 6/6/2024
2024.0.12.15608 124 6/4/2024
2024.0.12.15515 179 6/3/2024
2024.0.12.15220 113 5/31/2024
2024.0.12.15220-alpha31-240... 86 5/31/2024
2024.0.12.14911 143 5/28/2024
2024.0.12.14910-alpha28-240... 103 5/28/2024
2024.0.12.14823 117 5/27/2024
2024.0.12.14522-alpha7-2405... 117 5/24/2024
2024.0.12.14514-alpha6-2405... 104 5/24/2024
2024.0.12.14511 138 5/24/2024
2024.0.12.14314 154 5/22/2024
2024.0.12.14114 159 5/20/2024
2024.0.12.12815 160 5/7/2024
2024.0.12.12814 122 5/7/2024
2024.0.12.12721 141 5/6/2024
2024.0.12.12702 130 5/5/2024
2024.0.12.12622 160 5/5/2024
2024.0.12.12514 137 5/4/2024
2024.0.12.12512 135 5/4/2024
2024.0.12.12510 139 5/4/2024
2024.0.12.12420 103 5/3/2024
2024.0.12.12319 96 5/2/2024
2024.0.12.12319-rc-2405021801 72 5/2/2024
2024.0.12.12318 92 5/2/2024