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.
#:package DbUpgrade@2.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DbUpgrade&version=2.0.1
                    
Install as a Cake Addin
#tool nuget:?package=DbUpgrade&version=2.0.1
                    
Install 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 (1)

Showing the top 1 NuGet packages that depend on DbUpgrade:

Package Downloads
TechAppBuilder.Complete

Complete TechAppBuilder suite with core TAB components for .NET 5.0 applications including Core, Common, CheckIn, CustomHookManager, Media, and TQL modules

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.1 132 1/29/2025
2.0.0 161 12/16/2024
1.2.1 140 6/13/2024
1.2.0 2,012 1/4/2024
1.1.19 2,816 5/11/2023
1.1.18 2,440 3/9/2023
1.1.17 825 3/9/2023
1.1.16 1,729 9/20/2022
1.1.15 2,033 5/19/2022
1.1.14 1,068 5/17/2022
1.1.13 1,095 5/16/2022
1.1.12 1,039 5/13/2022
1.1.11 1,552 2/7/2022
1.1.10 1,101 2/7/2022
1.1.9 1,123 2/7/2022 1.1.9 is deprecated because it has critical bugs.
1.1.8 1,138 2/3/2022 1.1.8 is deprecated because it has critical bugs.
1.1.7 924 11/22/2021
1.1.6 1,172 11/5/2021
1.1.5 1,018 10/7/2021
1.1.4 941 10/6/2021
1.1.3 1,058 10/6/2021
1.1.2 3,458 9/22/2021
1.1.1 4,333 9/1/2021
1.1.0 961 8/13/2021
1.0.9 996 6/23/2021
1.0.8 12,559 12/11/2020
1.0.7 1,762 9/8/2020
1.0.6 1,282 9/4/2020
1.0.5 1,168 8/28/2020
1.0.4 1,430 6/15/2020
1.0.3 1,183 6/15/2020
1.0.2 1,267 6/8/2020
1.0.1 1,199 5/20/2020
1.0.0 1,188 5/20/2020