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 111 1/29/2025
2.0.0 146 12/16/2024
1.2.1 125 6/13/2024
1.2.0 1,929 1/4/2024
1.1.19 2,803 5/11/2023
1.1.18 2,425 3/9/2023
1.1.17 811 3/9/2023
1.1.16 1,716 9/20/2022
1.1.15 2,015 5/19/2022
1.1.14 1,049 5/17/2022
1.1.13 1,072 5/16/2022
1.1.12 1,020 5/13/2022
1.1.11 1,534 2/7/2022
1.1.10 1,080 2/7/2022
1.1.9 1,087 2/7/2022 1.1.9 is deprecated because it has critical bugs.
1.1.8 1,102 2/3/2022 1.1.8 is deprecated because it has critical bugs.
1.1.7 904 11/22/2021
1.1.6 1,149 11/5/2021
1.1.5 999 10/7/2021
1.1.4 923 10/6/2021
1.1.3 1,038 10/6/2021
1.1.2 3,440 9/22/2021
1.1.1 4,315 9/1/2021
1.1.0 944 8/13/2021
1.0.9 978 6/23/2021
1.0.8 12,513 12/11/2020
1.0.7 1,738 9/8/2020
1.0.6 1,250 9/4/2020
1.0.5 1,143 8/28/2020
1.0.4 1,409 6/15/2020
1.0.3 1,162 6/15/2020
1.0.2 1,246 6/8/2020
1.0.1 1,174 5/20/2020
1.0.0 1,145 5/20/2020