DbUpgrade 2.0.1

dotnet add package DbUpgrade --version 2.0.1
                    
NuGet\Install-Package DbUpgrade -Version 2.0.1
                    
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="DbUpgrade" Version="2.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DbUpgrade" Version="2.0.1" />
                    
Directory.Packages.props
<PackageReference Include="DbUpgrade" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DbUpgrade --version 2.0.1
                    
#r "nuget: DbUpgrade, 2.0.1"
                    
#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.
#addin nuget:?package=DbUpgrade&version=2.0.1
                    
Install DbUpgrade as a Cake Addin
#tool nuget:?package=DbUpgrade&version=2.0.1
                    
Install DbUpgrade as a Cake Tool

DbUpgrade

Database upgrade helper for .NET Core, support MSSQL

Example

static async Task Main(string[] args)
{
	var configuration = new ConfigurationBuilder()
	   .SetBasePath(Directory.GetParent(AppContext.BaseDirectory).FullName)
	   .AddJsonFile("appsettings.json", false)
	   .Build();
	
	UpgradeEngine.To
                // [REQUIRED] set connection to database
                .SqlDatabase(configuration.GetConnectionString("Database"))
                // [OPTIONAL] create a database if it doesn't exist
                .CreateDatabase()
                // [REQUIRED] for one of them
                .WithScripts(Assembly.GetExecutingAssembly()) // get scripts by assembly
                .WithScripts($"{AppDomain.CurrentDomain.BaseDirectory}/Migrations/Once", true) // get scripts by path
                // [OPTIONAL]
                .LogToConsole()
                .LogToFile()
                .LogToTable("log")
                // [OPTIONAL] defaut values: commandType = CommandType.All and execute = true
                .ForCommand(DbUpgrade.CommandType.Create)
                .ForCommand(DbUpgrade.CommandType.Alter)
                .ForCommand(DbUpgrade.CommandType.Drop, false)
                .ForCommand(DbUpgrade.CommandType.Data)
                .ForCommand(DbUpgrade.CommandType.Unknown, false)
                // [REQUIRED]
                .Build();
	
	// var commands = UpgradeEngine.CommandsToRun;
	
	UpgradeEngine.PerformUpgrade();

#if DEBUG
	Console.ReadKey();
#endif
}

Optional

// For 'WithScriptsFromAssembly' option
<ItemGroup>
	<EmbeddedResource Include="Migrations\*.sql" />
</ItemGroup>
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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.1 106 1/29/2025
2.0.0 143 12/16/2024
1.2.1 122 6/13/2024
1.2.0 1,898 1/4/2024
1.1.19 2,800 5/11/2023
1.1.18 2,422 3/9/2023
1.1.17 808 3/9/2023
1.1.16 1,713 9/20/2022
1.1.15 2,011 5/19/2022
1.1.14 1,045 5/17/2022
1.1.13 1,068 5/16/2022
1.1.12 1,016 5/13/2022
1.1.11 1,528 2/7/2022
1.1.10 1,074 2/7/2022
1.1.9 1,078 2/7/2022 1.1.9 is deprecated because it has critical bugs.
1.1.8 1,093 2/3/2022 1.1.8 is deprecated because it has critical bugs.
1.1.7 898 11/22/2021
1.1.6 1,143 11/5/2021
1.1.5 993 10/7/2021
1.1.4 917 10/6/2021
1.1.3 1,032 10/6/2021
1.1.2 3,434 9/22/2021
1.1.1 4,309 9/1/2021
1.1.0 938 8/13/2021
1.0.9 972 6/23/2021
1.0.8 12,500 12/11/2020
1.0.7 1,729 9/8/2020
1.0.6 1,237 9/4/2020
1.0.5 1,134 8/28/2020
1.0.4 1,400 6/15/2020
1.0.3 1,153 6/15/2020
1.0.2 1,237 6/8/2020
1.0.1 1,165 5/20/2020
1.0.0 1,136 5/20/2020