dotnet-db-migrate 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global dotnet-db-migrate --version 1.0.0
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local dotnet-db-migrate --version 1.0.0
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=dotnet-db-migrate&version=1.0.0
nuke :add-package dotnet-db-migrate --version 1.0.0

A .NET Core Global Tool to deploy changes to SQL databases using DbUp.

Installation

dotnet tool install -g dotnet-db-migrate

At this point you will probably have to add the global tools path to PATH variable. Global tools are installed to %USERPROFILE%\.dotnet\tools (Windows) or $HOME/.dotnet/tools (macOS/Linux). You can add the tools directory to yur PATH using one of the following commands.

Windows: setx PATH "$env:PATH;$env:USERPROFILE/.dotnet/tools" Linux/macOS: echo "export PATH=\"\$PATH:\$HOME/.dotnet/tools\"" >> ~/.bashrc or your terminal of choice.

You will need to restart your terminal.

Usage

Once installed, running dotnet db-migrate -h will print the following help information.

A tool to deploy changes to SQL databases.

Usage: db-migrate [arguments] [options]

Arguments:
  ConnectionString    Required. The connection details for a database.

Options:
  -h|--help           Show help information
  -p|--provider       Optional. The connection provider. Default: mssql
  -s|--scripts        Optional. The path to the migration scripts. Default: scripts/
  --ensure-db-exists  Optional. Create the database if it doesn't exist. Default: false

Example Usage

dotnet db-migrate "Server=localhost;Port=5432;Database=northwind;User Id=postgres;Password=password;" -p postgres -s src/scripts/Postgres --ensure-db-exists

Output
Master ConnectionString => Host=localhost;Port=5432;Database=postgres;Username=postgres;Password=********
Created database northwind
Beginning database upgrade
Checking whether journal table exists..
Journal table does not exist
Executing Database Server script '201806172131-Create-Contacts.sql'
Checking whether journal table exists..
Creating the "schemaversions" table
The "schemaversions" table has been created
Upgrade successful
Success!

Currently only MS SQL Server and Postgres are supported, this is due to --ensure-db-exists flag and how DbUp creates databases.

Contributing

This is an open-source project. I request your participation through issues and pull requests!

License

dotnet-db-migrate is licensed under MIT. Refer to LICENSE for more information.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.1 is compatible.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
2.2.2 666 11/9/2021
2.2.1 383 11/9/2021
2.2.0 389 11/9/2021
2.1.0 591 5/20/2020
1.0.0 956 9/13/2018